Either can be correct in different situations.
I am writing something to you ( a letter, an email,) where the purpose of my writing is to communicate with you.
I am writing something for you (an essay, a report) where I am either writing something on your behalf (for example, you don't have time to write it yourself) or I am writing something for you to read, but it is not necessarily to tell you something you don't know.
Examples:
I am writing a letter TO you, to tell you what I have been doing this week.
I am writing this letter (to your aunt) FOR you, because you have broken you arm, and can't write.
I am writing this essay FOR you, so you can assess my level of English.