Hi,
Your question is not directly affecting PyTorch, so you can save the eta variable in a list with same length of number of epochs and at the end of the loops, write it into a file using python open(file_path, 'w+') method.
There are other ways to do it though.
But something you should consider is that writing to a file is a slow process in comparison to tensor operations, so it is not good idea to write into files within your training or testing workflow, so just save the value in a array and when the loop finished, write to disk.
Bests
Nik