"have written" indicates that the process of writing has finished. It could be used with another adverbial, for example:
- I have written two letters in three hours. They are ready to be delivered.
"have been writing" indicates that the process is still ongoing.
- I have been writing two letters for three hours. I hope I can finish them soon.