So write it to file... or print it to file:
>>> help(print)
Help on built-in function print in module builtins:
print(...)
print(value, ..., sep=' ', end='\n', file=sys.stdout, flush=False)
Prints the values to a stream, or to sys.stdout by default.
Optional keyword arguments:
file: a file-like object (stream); defaults to the current sys.stdout.
sep: string inserted between values, default a space.
end: string appended after the last value, default a newline.
flush: whether to forcibly flush the stream.
(END)
As you can read print() function in Python supports a "file" argument, which specifies where the function should write a given object(s) to (default is sys.stdout). But one can specify file and do something along those lines:
with open('my_file.csv', 'a') as f:
print(f'{name}, {surname}', file=f)