You should not write letters to a sitting judge about a case you are involved in. Generally, professional communications with a judge about a case should be in legal pleadings, filed with the court with copies sent to the other side. Special procedures exist for emergency communications but writing a letter is not among them.
How to Write a Professional Letter to a Judge
Pleading Your Case
The U.S. justice system is based on the principal that parties communicate with a judge in court, not in private. That is why every paper you file in a case must also be provided to the other side in a lawsuit. Contacting the judge by letter during a case is improper and can result in court sanctions including fines.
Ex Parte Motion
In an emergency situation where you do not have time to give the other side notice as required by the rules, you can file an ex parte motion in court. This explains your circumstances and asks the judge to allow you to bring a request to the court without the other side present. Even if the motion is granted, the judge generally sets a hearing to reconsider the question with both sides present.
Writing a letter to a judge is only appropriate for matters that do not involve you personally, such as character letters on someone else's behalf. These are sometimes accepted in criminal sentencing and immigration cases.