After writing "Dear..." it's a good idea to establish the main purpose of the letter straight away in your opening sentence. Here are some examples:
1. Formal letter (e.g. complaining to a manager)
I am writing to complain about the unacceptable state of the room I was given, and the unhelpful attitude of certain members of staff at your hotel.
2. Semi-formal letter (e.g. inviting a neighbour)
My wife and I would like to invite you to a dinner party at our home next Saturday evening.
3. Informal letter (e.g. thanking a friend)
I hope you're well. I'm just writing to say thanks for letting me stay over at your house while I was in London last week.