Welcome to the forums and thanks for reaching out. I'm sorry to hear about what you went through; it must've been difficult to deal with that. It sounds like your ex boyfriend was toxic and he is not sure about who he wants to be with. I'm sorry that you were subjected to physical abuse; what happened was not your fault and you didn't deserve that.
The best that you can do for yourself is to walk away and never contact him again. You deserve someone who wants to be with you and respects you. If he does try to contact you, it's best not to respond and if he physically appears in your life, then I personally would take action against him, probably even filing a restraining order, as you don't want to be subjected to abuse again.
I know it is hard to deal with what you want through and it may be hard to process, which is why you should speak to someone about. Maybe reach out to your family and friends and explain the situation so they can provide you with support when needed. If you are finding it quite difficult to deal with what happened, then I would suggest to see a professional such as a counsellor or a psychologist. You can ask your GP for a referral to see one. You might find it useful to talk to someone and it might help you deal with your anxiety and depression. It will be difficult to move on, but the best thing to do is to focus on you. Take all the time you need to heal and deal with the breakup, but know that things will get better with time. Hope this helps.