It is fine to send him a letter. It is a very adult thing to do. Just be sure that you are not doing it to get a certain reaction from him. It is better to write the letter because you feel you have something to say with no expectations of any reaction from him at all.
If you choose to write the letter, I'd advise you to steer clear of talking about him - what he did, or said, or thought. Talk about yourself. Tell him about you, not him. He knows about himself, and you know about yourself. So, if you are talking about yourself, you can speak knowledgeably. If you talk about him, you are drawing conclusions that he may disagree with, and it puts him off when he reads it. He will see that as attacking him.
Be aware that depending on the level of stress between the two of you, you never know when communication may completely break down. You may get a response to your letter, or he may never acknowledge it. It is good to say your piece so that you do not go into the divorce with misunderstandings.
However, if you cannot write a letter without anger or name calling or accusing him or bad deeds, then it is probably better not to put a pen to paper.