My ex is married but is the father of my child and wants me back?

We were together for 6 years on & off and we had a baby at 20 & 21. We broke up & he eventually moved on & met a girl. I kept trying to get him back but he wouldn't give me a chance. He proposed to her & they got married within 8 months. I was so mad because he never married me and I'm the mother of his child. I kept our daughter away from him and he took me to court. It's been 8 months since all that and at drop offs, I started to come onto him, and we started talking about having our family together because he wants to see our daughter every single day. So we hooked up and he told his wife about it the same day and she kicked him out. He moved 4 hours away with his brother. He came to get me and our daughter to stay for a few days. We went up there for 4 days and we ended up argueing over the same old things and he told me I haven't changed and that it was a mistake giving me a chance and he knows that we'll never work out. I agreed with him even though I do want us to work. But now he went back to his wife to try to work things out with her. I just wanted to get him back and now I ruined my chance. He said it was a mistake to give me a chance. He said I wasn't worth losing his wife over and went home to try to make up with her and work things out with her. So now our co-parenting is worse than ever because I'm so mad about everything. I feel like he played me. He should have left me alone. He just went right back to his wife.