Like you said a mutation within a gene and effect the protein produced but the answer to your question lies in the definition of both a gene and an allele. A gene is a segment of DNA which codes for a protein but an allele is a variation of a gene eg. eye colour and dominant and recessive traits. There is a specific gene that codes for eye colour but different colours are effected by alleles of that gene.
Mutations change the structure of a gene in a few different ways (deletion, addition, you will learn more later). When a gene is mutated it can create a new allele. If this allele is advantagous to an organism it may create a "new generation" of that allele. this is the case in evolution and to a lesser extent adaptation.
I hope this claraifys your question, post back up if it doesn't.
Cheers.