What should I do

I hurt my bf feelings like while I was with him I was talking to somebody like just flirting with them but I was in a past then the person that I was flirting with texting my dude saying I'm not loyal and that he should get me to the curb me and him had serious conversation I said yeah I did it but because I heard you had a girlfriend so I talk to somebody else just to make him upset and he said thiat is was childish and Petty and I shouldve talk to him about it like he did and I told him ik and like I regret it I did it twice tho he found out different days but he did the same thing to but like I don't know what to do I just feel dumb I need some advices or something