Anyone know if in the long run it could cause ed? or is it the opposite (took test for 5 month and stopped)
It can definitely cause ED in some patients, usually if the testosterone dose is too high or the period between injections is too long (more than a week).
If TRT is done right, see stickies here, libido will be optimal. ED in terms of the blood flow/hydraulics is a separate consideration. TRT will not impede blood flow during erections and restored nocturnal erections helps maintain penis health and size. Basically, there is no concern if you follow the advice given here. Getting a doctor to do things right can be a problem, see the finding a TRT doc sticky.
Sounds like you stopped TRT or a cycle, also sounds like cold turkey, crashed hormones can=ED until natural test starts production again, this is a physical/emotional side effect. As Ksman said, the blood flow issue is another issue, not proper TRT.