Is saying my apologies a good idea?

It's been some time since my first relationship and I feel like I can't move on until I apologize for my wrongdoings but we had a bad breakup and everyone is telling me not to text her that I could get in trouble but I hope/feel I wouldn't because even though we had a bad ending the relationship was good in my opinion well I'm just asking is it a good idea to apologize or so I just leave it be?
Is saying my apologies a good idea?
Post Opinion