Erection problem can be due to lifestyle factors like taking alcohol, smoking or being overweight. It may also be due to any major illness or due to some medicines. Often it can be due to stress / anxiety or due to blood abnormalities for which you need to do blood tests Hb, TC, DC, fasting
sugar,
Prolactin,
TSH,
Testosterone. Walking half an hour daily will help. If you are in some office job then every half hour get up from your chair and walk around for 5 minutes, it will help circulation in the penis.
Some couples practice fertile period or ovulation method for sex, it puts stress on partner by making a pleasureable activity into a TASK of performing and he develops Erection problem. It can be overcome easily if they forget the ovulation time and do sex all through the month whenever possible.
If you want medicine prescription then can ask a paid query/ consult online with me. Otherwise above information should work for you.