No you don't. Your ability to put on and maintain muscle mass has nothing to do with masturbating. The only "danger" - if it could ever be called a danger - is that if you masturbate before working out, you might sap your strength - be more tired. Masturbating and sex, like eating higher than average amounts of protein and lifting heavy weights regularly, will boost your testosterone levels naturally - which allows you to gain size and maintain it.
So, if you're training smart - not over training - and maintaining a reasonable diet high in protein and the right kind of carbs you'll be fine...even if you masturbate twice a day. The only thing that you compromise is your energy.
Hope that helps.