Allowed by the (British!) dictionary
write somebody (North American English) Write me while you're away. https://www.oxfordlearnersdictionaries.com/definition/english/write
It is used even in formal texts, like some modern translations of the Bible https://biblehub.com/romans/15-15.htm
Both versions are accepted as both are correct. If you want to know whether a BrE alternative is accepted, you can either try it -- and Report if your answer is rejected -- or Report and ask about it. The Report option is strongly recommended.
Duolingo, being based in the US, leans by default toward US usage. BrE usage is not likely to override AmE usage, especially when, as in this case., AmE usage is recognized by an authoritative BrE source.