First, as Mark Johnson said.
Second, the job of police and prosecutors is not to put people into jail, their job is to put guilty people into jail.
If you go to the police and tell them that you beat up a person, then before they investigate, they know that either you are guilty of assault, or you mistakenly believe that you are guilty of assault, or you are a phantasist who enjoys confessing non-existing crimes to the police.
The police will either investigate which one it is, and may prosecute you either for assault or for wasting police time, or they may decide based on your behaviour that there was never any assault and not investigate further. I suspect they will at least question you about details of the claimed assault, to decide whether the crime is real or not.