Not getting proper erection of penis could be because of many reasons. One of the main reasons could be anexity and depression which slowly ends up in decreasing testrosone levels in blood and other harmonal balances causing this. The other reasons could be High or Low Blood Pressure also which you never know you have and is very serious too. So better visit A Cardiologist to get Heart chekup first followed by an Endochronologist who might get your harmones levels like Serum Testostrone, T3, T4, TSH, FSH, LH and Prolactin checked and a Psychiatrist who might check you up for Anexity and or Depression related problems. Once exact reasons has been identified, do the teatment and you will be alright. Do visit all of them to reduce any chance of misdiagnosis or incomplete diagonosis and tell all the Doctors very clearly that this is your problem and you want to get checked up to for every possible cause. Generally it takes few months to get ok so be patience also while getting treated.