Translation:At the end of the course we have to write a long exam.
"Write an exam" is not what we would usually say in the UK. We'd probably say, "At the end of the course we have to do a long exam."
In my experience in the UK (all my life!!), I have found we are far more likely to say, "take a test" or "take an exam", and more colloquially, "do a test" or "do an exam". If we wanted to emphasise that the test or exam was a written one, as opposed to an oral test, we might say, "do a written exam". But "writing a test" would be what the people who set the test do.