Since it looks like you have the dataframe part working correctly, if you want to copy the first 10 lines from the input file to the output file, just read it in real quick. You can use the readline() function rather than read() so you don't accidentally digest the entire file. Using a list comprehension as a hack allows you to conrol how many lines you want to use. In this case, we're reading in 10 lines with the help of range(10) as your iteration counter. Using the context manager (with), you don't have to worry about file access issues when you're reaady to read the dataframe.
with open('inputfile.tsv') as f:
header = [f.readline() for i in range(10)]
The comprehension is the same as the code below, just a lot easier to scan and comprehensions tend to work faster than loops.
# don't actually do it this way
header = []
with open('inputfile.tsv') as f:
for i in range(10):
header.append(f.readline())
When you're ready for the outpt file, just join the lines together before you print out the data. If you omit the file handler in the df.to_csv() function, it will return the string. You can immediately print out the data right below the header
with open('output.txt', 'w') as f:
f.write("".join(header))
f.write(df.to_csv())