Idk how to do this

Idk how to block someone and not message them again. I was in a toxic relationship for over two years and he broke up with me and got with someone else. I moved on but it took four months. He came back because he broke up with her and said he missed me. Look I know he is horrible and I shouldn’t have went back because he didn’t deserve me and he’s a pos but idk I did anyway because I’m stupid. I’m really lonely I have no friends and he’s the only person I can really talk to. We started dating again then two days later he broke up with me again. I tried to block him and move on but it’s hard for me to do that. Idk how to block him and just not text him again or not go back to him. I was so sad and I couldn’t stop crying for days then the minute I unblocked him I felt better. I want to move on but it’s hard.