Why do you need the a?
I think the question is about the "a" in front of mange. Why is that necessary for past tense "ate"?
It's the compound past, which is what this whole lesson demonstrates. Conjugate "avoir" (have) with the past participle "mangé" (eaten).
One of the options for this sentence was Il a mangé une amie. Duo, we know your secret...
Why this answer " je mangai une baguette" is not accepted?
Duolingo does not teach the passé simple tense. That tense is reserved for history and literature and not for everyday French. Instead, use the passé composé (j'ai mangé).
Also, it's spelled "mangeai."