It's true. It IS your fault. You messed up. You feel guilty. Ashamed. Unworthy. And for good reasons.
So what do you do with that? One thing you can't do is make it right on your own. You need help from above.
Something I see in my work is that even though men know they are sinners, they think God's standard is to never make mistakes. So when they do sin, they feel deeply that they need to fix it on their own.
Listen. All of the men and women that God has ever used greatly have been deeply flawed. Here it is: If God didn't use flawed men, he wouldn't have any to use it all.
So the starting point is NOT something you do, but something you DON'T do. You don't expect to be perfect. And when you stumble, you don't try to solve the problem on your own.
What to do instead? Admit you made a mistake, own it, humble yourself before God, repent, apologize to the offended, ask forgiveness, in some cases seek counseling, make restitution if necessary, talk it out, hug it out. And in most cases you will have to rebuild trust over time, especially if you messed up in your marriage.
So don't be impatient. Don't give up. You can get through this. And with God's help, you will. Take the steps you can and give it a couple of years.