Thanks for your query.Based on the facts that you have posted it appears that you have problem of erectile dysfunction
. You have consulted sexologist
and was advised to take Megalis and getting headache which is known side effect of this group of drugs.
Though you are getting erection it is not hard enough to penetrate vagina. Please consult qualified urologist
.You need to get following investigation like Colour Doppler ultrasound
study of the penis done to study penile Arterial and Venous circulation.to find out cause of erectile Dysfunction.