Lexer: output the token list to a file