Mental Harassment and it's scope

I have been working in a corporate office for arround 3 yrs., last the company terminated me for harassing a woman in my office. The woman and I where close colleagues we meet in March 15, since the colleagues stays near me I use to pick her and drop her home several times. We use to party together and exchange messages. Everything was going well, till I started liking her. She told me that she don't have any feelings for and started distancing from me. One day we had an argument and after that everything between us stoped. I kept her messaging and she didn't reply. I wanted her to talk with me. One day I forced her to talk with me and she came and she was so frustrated that she told me i want to end everything between us. Then I really felt bad about it and decided to apologise in front of everyone, personally also i had apologies to her several times. So one day I droped a mail to HR stating that whatever been happened from past is not going well and my colleagues has stopped talking to me and apologised keeping our close colleagues in cc of the mail chain. They where all aware of the personal tension between us. She thought that I am spoiling her reputation in office and told the HR that She is been mentally harassed by me and was going to complaint about it earlier, but didn't wanted to spoil my career so didn't do anything but then she decided to take to HR. So after that the HR took me in writing that I won't message her and try to contact her in any form. But since then time passed and one day I messaged her let's hangout and that to at around 12 in night. I was a fool to ask her this , but then I really wanted to talk her and explain her that I really never meant to spoil her image, i really meant was to talk her. Se showed the to HR Aand got busted and got terminated. I really don't want to take any revenge but was the HR right with it's decision or should they have I put more effort to solve it internally by making us talked ?