The first thing to do is to look for any underlying cause. This requires a medical examination. It can be associated with several things such as cardiovascular issues, diabetes smoking, medicine you may be taking, hyper tension, previous pelvic surgery, neurological issues, sedentary lifestyle, and a huge one, psychological issues, etc. It's a pretty long list that they will want to see if it is associated with any of these. And if so, then working on those issues could help the ED. They'll give you a physical exam and ask you a whole slew of questions.
Then they can make some changes, even lifestyle change suggestions for you that MAY rally help overcome the issue.
Treatment when working on underlying issues (including psychotherapy for any mental health hang ups with erections) would include the well known pharmacologic agents used and given by prescription. Second line they go to Alprostadil or the vacuum pump. There are alternative therapies that I see no proof work. :>) Unproven, unstudied in a scientific way with a lot of claims that aren't backed up by science. They are often making money there but without the proof so be careful with those. And there is behavior modification therapy.
But likely you will have one of the underlying causes leading to your ED and if you work on that, it should improve. good luck