How do you heal from a relationship after gaining strength to walk away?
While any opportunity to be introspective is important, unfortunately, most only leverage this opportunity in times of distress, hurt, and desperation. To be introspective refers to look inward, to try and understand one's self, and engage in growth. When this important process is merged with distress, hurt, and desperation that drive us to this point, people often engage in unhealthy internal dialogue. This dialogue can include questions like, "Why me?", "Why do I....?", and "How come I can't stop...?" Rather than the growth that can prompt healthy change, these questions exacerbate the negative feelings that precipitated the questions. Another way to say this is, these questions often make people feel worse just by asking them.
In order to respond to your question, just note that there may be some assumptions I'll have to make, including a great deal of intra- and interpersonal context. I'll have to assume that part of you cares for this person and part of you has a significant dislike for this person. Most simply, I'll have to assume you go back because part of you wants to. These may be inaccurate assumptions but in general just understand that like you, I'll walk through this the best I can.
There is some important level setting that needs to be called out here - it is okay to want connections with other people! Your drive for companionship, care, and consistency make complete sense. The drive for affection, human connection, and trust is both natural and important. Your care for another person, who presumably you perceived caring for you at least a little while, is something you should hang on to. Genuine care for others in this world is lacking, and I'm glad you have that. You also appear to see both positive and negative traits for this other person - this is also important. Relationships with family members, friends, co-workers, etc, all have positive and negative aspects to them. This is a result of all people being at least partially flawed. Again, you care for a person in spite of their flaws is a positive quality that is understated in society - I hope you don't lose sight of that.
Where your path diverges is the amount of hurt you've received, and have continued to connect, be intimate, and affectionate with this person who also you feel hurt by. This requires vulnerability, and your confusion resulting from your hurt and care is worth validating - hurt is worse when it comes from those we care for. While your desire to care is an important part of yourself, I'd encourage you to explore how much hurt you're willing to endure? Are you willing to push through the emotional anguish? Are you prepared for long-term pain while you both grow? These are important questions that will help guide your decision to try again or separate. You could very well be willing to endure more hurt, but based on your question's phrasing it appears not.
So then what do you do with this? I've told you that your desire for relationships is an important quality, and this relationship seems to require a significant bit of effort from both of you to change, which will invariably involve hiccups that result in more emotional hurt. But your question asks about how to heal as well. Healing is an individual process that takes time, and introspection...healthy introspection. Instead of asking why you chose to stay and not walk away, consider asking how you can learn healthy relationships. What resources do you have? Who do you have trust with that maintains a few healthy relationships? If you don't know, can you try and find support groups? Questioning yourself will lead you inward, where your hurt comes from. I encourage you to look outward, find a different question to ask, and prepare yourself to learn.