Chandra Sekaran
Ansys Employee

The OPEN and WRITE commands are not APDL commands. Please use *CFOPEN and *VWRITE (and *CFCLOSE)

open('frequency_rotation.txt')    
write(unit, 'Frequency (Hz)  Rotation_X  Rotation_Y  Rotation_Z')

Also in below do loop I do not see a SET command to change the result set from one mode to another. Use SET command. Also may be you should do *VWRITE inside the DO loop and after *ENDDO use *CFCLOSE

do i = 1, num_freq
  *get, my_freq, active,,set,freq
   my_rot_x=ROTX(Measure_Pilot)
   my_rot_y=ROTY(Measure_Pilot)
   my_rot_z=ROTZ(Measure_Pilot)
   write(unit, my_freq, my_rot_x, my_rot_y, my_rot_z)
enddo