Stars build heavier nuclei through fusion, and stellar evolution redistributes enriched material into the interstellar medium. Later stars and planets form from material with that accumulated history.
The carbon, oxygen, and other elements used by life connect Earth to earlier generations of stars. Different elements have different production pathways.