Difficulty achieving erections after marijuana withdrawal is very normal for heavy users. Your mind is having to re-organize how it works essentially and for now it is producing less of the chemicals that enable arousal because it had become accustomed to the marijuana doing that job for it. Once you get over the withdrawal completely normal function should return, expect several more months of this. Drugs are bad, you were told before, I'm sorry you didn't listen.
I'm sure this isn't a good time for you but you're going to want to quit smoking as soon as you're able, as that's going to be an ED risk down the line for you.