Hi @AbdullahShah Welcome!
You don’t need a Code node for this. The Parse CSV node already outputs each row as an item keyed by the CSV headers, so those keys can become the column names directly.
In the Google Sheets node, use the Append Row operation and set Mapping Column Mode to Map Automatically. Then open Options and confirm Handling extra fields in input is set to Insert in New Column(s) (the default). On an empty sheet this writes the headers from the CSV field names on the first run, and a CSV with different columns adds its own new columns on later runs.