"then I am sorry" is it correct?

I just want to know if the below sentence is correct?

If I have hurt you in anyway, then I am sorry for it but I said what I thought was correct.

Hi Rahulpayne,

Your sentence is correct. Where did you come across it?[YSaerTTEW443543]

TOEIC listening, question-response: Wouldn’t you rather telecommute?[YSaerTTEW443543]