Output a fix print at specific timesteps defined from a file

Please see the post Please Read This First: Guidelines and Suggestions for posting LAMMPS questions for how to properly quote text from input files in this forum software.

Your looping is not quite correct and using fix print is not really meant for that purpose. What should work the way you describe is the following (note how it displays correctly unlike in your post):

variable tss file timesteps.txt
print "step temp" file output.thermo screen no
label loop
run ${tss} upto post no
print "${varstep} ${vartemp}" append output.thermo screen no
next tss
jump SELF loop