Your ability to have an erection that is capable of penetration says to me that ‘physically’ you are okay. Sustaining an erection is most likely phycological as is getting an erection providing you have no physiological impediments.
Personally, I would print out this thread and show it to an endocrinologist, start there and move on to phycologist if necessary.
Sex drive comes and gos the older you get and yes some hormones can effect this for better or worse.
And lastly, no masturbation, no porn, no alcohol and no smoking. (You make no mention of this so I thought I would bring it up, no pun intended.)
I have confidence it will return. You just have to have patience and confidence.
Your brain is is the most powerful sexual organ.