From your question, we cannot be completely clear as to what the problem is. I assume that either your school administration does not want you and your friends to sit together or they do not want to allow you to continue sitting together past a certain time. In either case, there are some general guidelines you will want to follow.
First, it is extremely important that you find out the principal’s reasoning for trying to prevent what you and your friends want to do. If you simply write to the principal complaining of “injustice” you are not likely to get a good result. Instead, you will need to find out what the principal is thinking as he/she surely has a rationale for the rule.
Second, once you have found out what the rationale is, write a letter that shows why that rationale is flawed. You need to show the principal that the concerns that led to the rule are not valid. If the principal says you cannot sit together because you might create a discipline problem, you could say that you and your friends do not cause discipline problems. You might promise to break up your group without complaint if you ever do cause a problem.
In other words, the most important thing to do is to address the principal’s specific concerns rather than simply complaining that you are being treated unfairly.
Outside of that, you should remember to write respectfully and formally. You should not criticize the principal but rather seek to set out your own view on the issue. You should not complain but rather make a request that is based on logic. Remember to proofread so that you will not have a bunch of spelling mistakes or other errors. You will be more persuasive if you sound as if you have put a lot of thought and effort into your letter.