You are opening the file during every iteration of your timer, this is very inefficient. Also, whenever you open a file in write mode (i.e. 'w') it will overwrite the current contents of the file. What you should do is open the file once, and just write to it inside your timer. Example:
Code:
logFile = open ('time.txt','w')
def RecordTimer(pos, currentTime):
currentTime = viz.tick()
pos = gball.getPosition()
save = '%d %.4f %.4f %.4f'%(currentTime * 1000,pos[0],pos[1],pos[2])###original
logFile.write(save)
print save
Also, if you want to append data to a file, you can open it using the 'a' flag, instead of the 'w' flag.