In order to set aside a restraining order, the court has to make findings that the restraining order is no longer necessary. Generally, what a judge is looking for is some sort of affirmative effort on your part to address whatever the issue was at the time of the restraining order. Anger management counseling, domestic violence classes, substance abuse treatment and couple's therapy are all good indicators that the restraining order is no longer necessary.
It depends whether you are the restrained person or the protected person. Don't write the letter if you are the restrained person.
If you are the protected person, tell the court why you no longer need to be protected, what steps you have taken to ensure that you don't need to be protected.
This answer does not create an attorney-client relationship. It is advisable to consult with an attorney with full disclosure of relevant facts for a comprehensive leagl opinion.