my intention wasn’t to hurt him
Not berating, just a question.
What response where you expecting from him? On some level, regardless of your intention, you must have known it would hurt him surely?
Any other feeling apart from hurt/anger/shock from him would be surprising.
It does seem like offloading and guilt, due to the effect it was having on you, were the primary reason you told him.
All you can do now is stay calm, give him space, be truthful if he asks for details of the ONS, understand that he will be going through a wave of emotions and probably feel very confused about you, the relationship and the baby.
With cheating,
it can be difficult to put yourself in the position of your betrayed partner, as you're embroiled in your own feelings.
Much of your words are about you and how you feel. What could lead to the end of your relationship is a failure to fully, openly acknowledge his pain, which you have caused.
He will simply view you as selfish, even if that's not your intention.
This was 4 years ago, but for him it's just happened. It's important you bear that in mind.