Tell your husband the truth, ASAP. There are no excuses for your actions. By not telling him, you are living in a lie day after day. He deserves the truth.
If your relationship was weak and you were unhappy, it was up to you to communicate to your husband how you were feeling. You chose not to. He is not to blame whatsoever what you did. Please be honest with him. Tell him 100% the truth.
I did not have sex with my husband for a very long time after my spinal fusion. He did not seek elsewhere to meet this important need. Instead he waited for me very patiently. He never complained or shown disappointment in me since my forever neck injury.
Please tell him. He deserves to know. Not telling him will not fix your marriage and your problems will just get worse if you both don't fix them. Good luck.