I don't think a letter is a good idea. In part, it's because if you give her something written, and it supports her version of reality, then she can constantly go back to the letter as proof that you are a terrible, evil ogre in spite of the fact that you're apologizing. The other issue is that, in my opinion, it's pursuing behavior and that usually backfires.

I have no issue with apologizing, but I think it should be done in person and not in writing. That way, there's not an artifact of things gone wrong.

If your wife wasn't in an affair, I may feel a bit differently, but I think something in writing would just provide fuel for the fire.