It is that simple!
So, you need to go to her and apologize.
Tell her exactly why what you did was wrong.
And... Tell her exactly why it won't happen again and what you would do if you were faced with the same type of challenge again in the future.
Can you do that?
Will you get her back?
Well, if she has already another man in her life, your chances are slim.
But she certainly won't give you even the slightest chance if she believes she will be treated badly by you in the future.
So, invite her for a drink and tell her in detail why it won't happen again.
By the way, a vague "I have changed" is not enough.
You need to understand in great detail why you behaved like a jerk and what is different now.