My dad told me a story once that I think resonates here. When he was a young man, he stole a bunch of tools from his former employer. He knew it was wrong. Eventually, it began to bother him and he knew that there was no way he could live with what he had done unless he tried to make it right as best he could.
He took all the tools back to his old boss, fully expecting to go to jail, and told him that he was sorry for stealing from him. To my dad's amazement, his old boss just kind of stared at him in disbelief, accepted his apology, and sent him on his way.
A sincere apology is the first step in taking responsibility for your actions. It takes a dose of humility to go to someone you've wronged and tell them, sincerely, that you acknowledge that what you did was wrong and you are sorry for your actions.
The second step is being ready and willing to accept the consequences for your actions. Whatever those may be. The third is to do the right thing next time.
A personal philosophy that I try to live by and one that I try to teach my kids is, "Don't do anything you're going to have to lie about. And if you do, don't lie about it. And if you do, come clean and make it right as soon as possible." If you're really a good person with integrity, living with your own lies or misdeeds eventually gets to be a heavy load. Apologies don't make everything ok and they don't undo your actions. But, they are an important first step in accepting responsibility for your actions and acknowledging the harm that you've caused.