Welcome to the forum.
As you have said, you know that you are wrong: there was an opportunity to buy a ticket before boarding the train, and you chose not to take it. So the law allows the railway to take you to court, and if they do so you will be convicted, and have to pay a fine, plus compensation to the railway, plus the prosecution's costs, plus court costs, plus a victim surcharge.
But assuming that this is the first time that you have done this, it is quite likely that the railway will agree to let you settle out of court.
@Hadders has an excellent piece of advice which they will probably post when they see this thread, but in brief
- wait for the railway to write to you
- write back explaining that you now know you were in the wrong and offering to pay the fare that you didn't pay plus the costs that the railway has incurred
- if you are lucky the railway will allow you to settle for the fare plus costs of around £100.
If you aren't lucky and the matter goes to court, I expect you will lose. This is something I've just posted for someone in a similar position:
What's the worst that can happen? You may go to court, and be convicted (either because you plead guilty, or because the court finds you guilty). If that happens, you will have to pay as I have explained above What will
not happen is being sent to prison - the only time that happens for not paying your train fare is if you were violent to whoever caught you, or if not paying your fare is linked to other criminal actions (theft perhaps or drugs). So the punishment will be in money.
You will also have a 'criminal record'. But this isn't too much to worry about. For most purposes, most offences become 'spent' after a while - which means that you don't have to tell anyone about the conviction after a given length of time. If you are convicted under the railway bylaws, then as I understand it the conviction is immediately spent (so you never have to tell anyone about it) and if your conviction is under the Regulation of Railways Act then it is spent after a year.
But there's some bad news: there are a few jobs and activities when you always have to declare any conviction - even after the conviction is spent. These tend to be things that involve handling money (maybe being an accountant) or dealing with the law and some medical roles. But there's a little bit of good news: even if you have to declare a conviction that may not stop you taking a role: as a couple of examples I know people who have gone on to train as teachers and nurses after getting a conviction for not paying a train fare - they had to tell their university about it, but the university didn't see it as a problem.
So all in all, please try not to panic. This problem won't go away, and it won't be nice going through it - but even if the worst happens it's not going to be the end of the world. If you want to go to university you will still be able to, and there are plenty of good jobs that you will still be able to do!