Before you write be clear what outcome you want from the letter. Do a rough structure. Keep sentences short and factual. Try to find the name of someone senior in the company and send it to him/her direct, marked PERSONAl, for the attention of x'. Good way to find this is via Google and if that does not bear fruit, try looking at one of their annual reports (about us section on company website usually has this). The CEO often does the intro to annual report. Each CEo office will have staff trained to deal with this stuff and it's much faster/ more effective to go to the top. Copy in the marketing/PR department of you can find even an email address. I ince complained to Tesco CEO and had some minion on the phone sweating , trying to resolve the issue. Nice. 
Beginning:
Be clear that this is a complaint that you EXPECT to be resolved. Eg I am writing to complain / with a further complaint about x. this situation has been going on for x time, and I insist on a response form you by x date, and remedial action to be taken by x date. I have set out below a short summary of the issue. also attached are previous emails/invoices/cores penance/advertising to assist you in a speedy resolution. Replay their own advertising and slogans back at this point 'x company promises to do this and in my case you did this instead'. (Marketing people hate that).
Middle: set out clearly the grievance. Short sentences, factual, keep emotion out of it. Dates, times, costs you've incurred etc
End: set out the action you REQUIRE and the timeframe you require them to be done ie not begging nicely with washy washy requests. This is also where the threats/ consequences come in. If you do not do xx I will be forced to do yy. Good threats include small claims court, raising your case with the Guardian (or other media outlet) and giving bad publicity, escalation to CEO, Twitter and social media (consider that anyway as it often gets swifter action) or local Trading Standards.
End with a short sentence that shows your reasonableness eg ' I trust that x company will welcome this final chance to rectify it's appalling customer service in this case and start to restore your previously good reputation and brand. I look forward to your written response by [date]
Yours faithfully (if letter starts dear sir/madam)
Sincerely if starts with a named person.
Don't forget your address, customer no etc (put this below address and above the 'dear'
RE: complaint about xxxx cust ref: xxxx invoice no: xxx
Hope this helps. Good luck !