The first two separate the actions of writing the letter and thanking him for his help. We might assume that the letter she writes is the way she thanks him for his help, but that is not necessarily the case. She could have written him a friendly letter and then thanked him in person. Or perhaps it suggests that the letter is mostly friendly, but includes a note of thanks at the end.
The third sentence suggests that the main intent of her friendly letter was to thank him for his letter. She wrote him a friendly letter. By writing the letter, she was thanking him for his letter. She wrote him a friendly letter, thus (by this action) thanking him for his letter.
The subject of the second part is slightly ambiguous. It also could be: She wrote him a friendly letter. The letter thanked him for his help. This interpretation might be more likely if you omit the comma.
Student or Learner