I travelled to Hajj with my family the year that I hit puberty. Unfortunately, I already had a habit of masturbation and I committed masturbation twice or thrice during my Hajj. I do not remember at what stage of the Hajj, wether it was in Ehram or not (I assume it was in ehram as well as without). I heard somewhere that I cannot enter into marriage before I make it right.
Please let me know exactly what I have to do to make it right and if indeed I cannot enter into marriage before offering kaffarah of Hajj.

Masturbation during ihram (hajj) is treated like intercourse. Assuming you did so before reaching muzdalifah, you must pay kaffarah and repeat it. However, there is no restriction on marriage. The kaffarah is to sacrifice a camel or cow. You must try to determine when you committed the act, and it seems, if you did it repeatedly then determine with as much certainty when. The hajj must be repeated yourself