Welcome to the forum.
By the sound of things, you have already emailed the railway, so you've already done the right thing. That means that for the moment you can relax because there is nothing more that you should do just now. The railway should get back to you eventually. They might offer you a settlement without going to court, in which case the easiest thing is to accept their offer, and pay them the money. Typically, this will be something like a hundred pounds for their costs plus the fare that you should have paid.
It's also possible that the railway might say that they want to take you to court. Try not to worry too much about that, because even then it may be possible to agree an out of court settlement. So make sure that you reply to every letter. Every time, write courteously and briefly to tell the railway that you are sorry, you know that you were in the wrong, that you have learnt your lesson and won't fare dodge again, and that you would like to agree an out of court settlement covering the fare and the costs that the railway has incurred. We do hear of settlements being agreed - even on the day that the matter goes to court - so it's always worth trying.
You need to allow a good six months for the railway to get in touch with you. That's because if they want to take you to court they have six months from the date of the offence to tell the court that they're going to prosecute you - and then it may take the court a few weeks to get in touch with you. But if seven or eight months have passed and you have heard nothing from the railway or the court, you can then decide that the matter is closed and there is nothing more to be concerned about.
And for the future, bear in mind that a useful tool to manage anxiety is to avoid unnecessarily stressful situations. One way of doing this is to make sure that you have paid the right fare for your railway journeys, so that you won't face conflict with ticket inspectors.