That's not true. If you have offspring, they have some of your genes. They don't have to be fertile.
For a better example, take humans: If you have a child and they grow up to be infertile, you have still passed on your genes. If they choose not to have children - even if fertile - you've still passed on your genes. Your particular mix of genes just won't live on in subsequent generations. Grandchildren aren't a requirement for you to simply pass on genes.
But you haven't passed on any genes. You have only been passed genes.
That is, if the choice of language confuses people: You have only been given those genes. You haven't given any genes to anyone else who can give those genes further, which is what matters in an evolutionary perspective.
And your parents passing on their genes to you doesn't matter, from an evolutionary perspective? You have only "been given" those genes, as if by magic?