Writing User defined variable to a text file

Hi,

I have developed a HETVAL user subroutine. I want to write output values of a user defined variable to a text file(at each calculation point). please help to get this done.

Thank you