Definitely a prolapse. I agree with
@Miss Lydia, we do need a better picture. Depending on the damage, part of it may need to be amputated off. I haven't done it before, but
@casportpony knows about cutting off part of the penis if needed.
For treating a prolapse, you will want to coat the penis in hydrocortisone ointment. Since it has been damaged I would also put bacitracin on it as well. If you can't get hydrocortisone ointment, but only cream, you can put it on first and cover it with bacitracin. The reason I recommend ointment over cream is it adheres to the tissue better and meaning it will get more of the steroid in its system. The hydrocortisone you will want to do 3-4 times a day to help reduce inflammation. Reducing the inflammation helps reverse the prolapse.
After coating it, you can gently push it back in. You may want to wait to see if you need to do any amputation. If it stays in you can just insert the hydrocortisone up his vent with a finger. I would continue this until he has no issues with the prolapse. When he defecates, that is going to be when it pops back out.
You will want to keep him separated until the issue resolves itself because the other ducks could aggravate it. With females, it usually takes about a month to heal. My drake who had a minor issue similar to this, it took him about 2-3 weeks before he go out with the flock. It would still pop out when he defecated, but only for a second before popping back in.