Ok I found it, I have to put stdout.writeln not writeln. But don't know why we have to force like this. More strange, I only changed the first writeln to stdout.writeln and all next writeln will print in file too !!! If someone know why, I would like to understand. Thanks.