Just keep it simple. Tell him it is unacceptable to behave like he did and why and you can show anger (a bit), frustration etc at first but don't go on about it. Make sure you tell him that you know he can do better in future and that you belive that he will. He needs to know you believe in him, even as you implement whatever punishment you think is appropriate.
What you have done so far seems fine (writing letter etc). If you want to implement another punishment, decide on one. Maybe ask him what he thinks is appropriate (you might be surprised how hard he is on himself). Implement the punishment then move on. In the end the actual punishment matters less than the fact that you implement it calmly and consistently.
After this has all died down, spend time with him as has been suggested, develop a closer relationship. Don't sit down and "talk", intead do things with him. While you are doing things you may find he opens up and things will come out to give you clues as to what is happening for him but you have to be present and pay very close attention for a while.
I am talking from experience. DS's behaviour was appalling at school in primary (truly very bad) for a very long time. At home it was not an issue in the same way so it was difficult for us to do much other than support the school and work with him at home on his empathy and how to behave etc. Where something was particularly bad we punished at home as well, though not for everything as that would have meant he was constantly being punished.
He came out the other side and is now doing so much better in school. It is like he is a different child but it took a lot of time and patience (not my best quality tbh).
DS does have ASD but tbh most of the issues around behaviour were to do with his lack of skills in a number of areas. Many "nt" children lack these skills in childhood as well so the same techniques but work with them though they will generally learn quicker than children with ASD, though some need more help than others to do so
Try not to despair of his behaviour or to catastrophise that this means he will be awful in future. This is very very hard to do when you have a child whose behaviour difficult and I didn't really manage that very well but it really does make things worse. DH was much better at dealing with DS calmly but firmly so I tried to follow his lead as much as possible, though I was much better at finding out what might have lead to specific incidents etc by spending time with DS.
One way of lookign at things that I found really useful is Ross Green's
life in the balance www.livesinthebalance.org/. His philosophy is that children do well if they can. That last bit if they can is really important.
He doesn't advocate punishments very often and in many ways I wish we had been able to implement this with DS but we did punish sometimes. Looking back though I do think that punishing a child for something is often more about showing others you care as a parent and being "seen to be a good parent" than actually helping that child to behave better. Ross Green uses somethiung called "collaborative problem solving" which is explained on the link
Often the child would behave better "if he/she could" . It is just that some children have less of that skill than others so they need to learn how to, like any skill it takes time to learn . The Ross Green website gives some really good ideas for how to deal with this and how to help your child.
Good luck OP I am certain you boy is going to come out fine.