Genes are sections of #"DNA"# molecule that codes for the synthesis of a protein and acts as a unit of inheritance.
#"DNA"# that make up chromosomes of cell is a heredity material. Genes are kinda helpers of #"DNA"# which assist it to perform its function being a heredity material. These are genes and not #"DNA"# molecules that are transferred from one generation to the next.
Genes carry the genetic information in the form of specific nucleotides' sequence on #"DNA"# molecule. These nucleotides' sequences on genes are transcribed to #"mRNA"# which is then translated into proteins.
Thus, genes are specific pieces of #"DNA"# that encode the information necessary for synthesizing the amino-acid sequences in proteins, which in turn play a salient role in determining the final phenotype, or physical appearance of the organism.

Hope it helps...