I travelled to Hajj with my family the year that I hit puberty for my Wajib Hajj. 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. I’m 30 years old and I have a lot of pressure to get married.
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.

If one masturbated during the ihram of the Hajj before going to Muzdalifah, one has to pay the Kaffarah and go to Hajj again (repeat it).

Now if you are not sure that this happened during the Ihram, then you can consider your Hajj to be valid. It’s very unlikely that this happened during Ihram because there aren’t really private places in Arafah for one to do that. So your Hajj is valid Insha’Allah and you can get married.