Its main function is production of sperm and hormone called testosterone.
The sperm is called as male gametes and is involved during reproduction, whereas the hormone called testosterone controls the formation of male body features which includes voice, moustache and beard development etc.
The production of testosterone from the testis is controlled by the luteinizing hormones.
DNA replication needs to occur because existing cells divide to produce new cells. Each cell needs a full instruction manual to operate properly. So the DNA needs to be copied before cell division so that each new cell receives a full set of instructions!