There's nothing any of us can do to merit salvation. That's impossible. Sin was judged at the Cross by Christ sheeding His Blood (Hebrews 9:22) and we are justified by His grace (Romans 3:24). The only question remaining is man's faith.
Salvation is by Grace thorough Faith. Simple as that.
It's not how bad the deed, or how often you do it, it's how good a mouthpiece you hire to plead your case.
You need a well connected lawyer and a well connected priest.
So9
A more introductory article, which also describes the actual process of confession is: Confession: Sacrament of Penance - Reconciliation
Scriptural support for the Sacrament of Confession can be found at: Scripture Catholic: Confession
Sin is doing what we know is wrong intentionally. We learn the Commandments, we learn the law of love taught to us by Jesus in the NT, we read the Bible, the Beatitudes, so we can learn what is wrong and what is right. Jesus brought us salvation by His sacrifice. We still have a responsibility to learn what is right and do it.
Confession is to make the sinner beholden to the priest.
"Sin lies only in hurting others unnecessarily. All other sins are invented nonsense." -- Robert A. Heinlein
IF it did, we wouldn't need Christ, would we?