Masturbating is not a bad habit if not overindulged in. The swelling that you notice in your lower abdomen could well be an inguinal hernia
which could be causing the discomfort you are mentioning. knee pain
might be an unrelated problem which needs clinical evaluation. i would recommend you to consult a good surgeon or a urologist
to get your painful ejaculation and the hernia sorted out.