Why "nicht" is at the end of the sentence?
Keine Ahnung. I thought "nicht" has to stay next to the verb?
Why is "Sie" used here? I thought it meant either "they" or "she"
If the 'S' in Sie is capitalized, then it can also mean 'you'
Correct, but "sie" was not capitalised. A typo/an error by Duolingo
Sie is also used for (formal you). Generally you can distinguish it with capital S for Sie in a sentence. Guten Tag.
Why can't you use Wofür?
I feel like that wouldn't make much sense here. Wofür translates to 'what for' so you would be asking "What for did not not buy it?" which could be proper, I'm not really sure. However, I find that using "Warum" makes the most sense here.