Hi,
Welcome to the ehealthforum and I am glad to help you out. An erection problem is the inability to get or maintain an erection that is firm enough for a man to have intercourse. If the condition persists, the medical term is erectile dysfunction. Causes may be psychological, smoking, alcohol, illicit drugs and medical conditions like diabetes, high blood pressure, heart or thyroid conditions, poor circulation, low testosterone, depression, spinal cord and neurological causes.
In your case stress and anxiety, sleep deprivation, poor diet and low testosterone levels can be responsible. You should consult a urologist and get prescribed testosterone supplements if they are deficient. also improve your diet and sleep apttern as it will also help a lot.
I sincerely hope that helps. Take care.