"This beautiful young kindergarten teacher is not sitting on the bus, but on a tram."
Translation:Ez a szép fiatal óvónő nem a buszon, hanem egy villamoson ül.
In contrastive, Not-X-but-Y sentences like this (not on the bus, but on a tram), the Hungarian needs to be nem X ... hanem Y with nem immediately before the X and hanem immediately before the Y.
Your sentence expresses a contrast like "not sitting .... but on a tram" which doesn't really work.
They are inconsistent with the use of egy. There are plenty of exercises where it could be legitimately included or left out, but only one version is accepted.
"jsiehler", you are doing a really good job with these eplanations on the "not-X-but-Y" concept!
On omitting "egy". In this particular sentence, it is much better to include the "egy", since it is contrasted with a definite alternative. "A buszon" vs "egy villamoson". Without "egy", the second part sounds too much like a general statement. But that is also possible, it is up to the context to determine.
You have to take care of what you put against each other by using "hanem". In your sentence, you compare "ül" (is sitting) and "villamoson" (on the tram), which is not correct and also sounds strange (like comparing apple and pear). So you could have 2 possibilities here:
Put two places (bus and tram) against each other, because those are WHERE the woman can sit: "Ez a szép fiatal óvónő nem a buszon ül, hanem egy villamoson." Here "a buszon" is after "nem", meaning that it is NOT the bus she's sitting on but the tram. So here the place is more important than the action.
Put two actions (sitting and something else, like standing ["áll" in Hungarian]) against each other, because those are which the woman can DO on a bus: "Ez a szép fiatal óvónő nem ül a buszon, hanem áll." (But of course it won't be correct for Duolingo, as the sentence lacks the tram, it's only for getting the idea.)
I hope this explanation helps you. :)