I grew up in churches where an invitation was given at the end of every service. As part of the invitation, people were invited to receive Christ and were led through “the sinner’s prayer”. This prayer was holy and awesome. It was the key to the Kingdom of God, after all. While as kids you might have messed around throughout the service, you didn’t dare misbehave at this point.
Variations of the same prayer have been around for a couple of hundred years and it persists to this day, although it’s use and invitations, in general, are far less common in churches today, especially those of the mega variety. There’s nothing wrong with saying this prayer. It’s one way to confess your need for Jesus. The problem is it’s not Biblical and it’s not enough.