Thanks for your query.Based on the facts that you have posted it appears that you are taking Fenesteride for hair loss and now facing problem of erectile Dysfunction
Finesteride is known to have side effects like decreased libido.flaccid erection and abnormal ejaculation. If these side effects persists for more than 4-5 months even after discontinuing the drug it remains permanent and very difficult to recover.
As regards your inability to-retract foreskin consult qualified Urologist
or General surgeon
for clinical examination You my need to get circumcised