output to file with text struct (now works)