I blame myself for how my last relationship ended
Do you blame yourself often?
Yes and I try to avoid repeating the pattern in my life
It's good that you are working to avoid this pattern.  Sometimes we all fall into self-loathing, but you should avoid that.  It can be hard to avoid that cycle once you start going down, and that can be mentally damaging.
How do I stop it?
You should know that things happen for a multitude of reasons, very few of which are your fault.  Relationships break down, and sometimes people just aren't compatible.  If you think that something is your fault, just remember that you did what felt right at the time, so you can't be blamed for unexpected outcomes.