well I imagined that because if this lines of code are alone in a sketch everything is good.
Another strange thing is if I add the same line twice or more times it can write them to the file.
Do you have any idea how this problem could be solved?
I would delegate the task to the linux side. Wrap the XML composition is a script (python, bash, you name it) and call the script with proper parameters (waterTmp, airTMP)
For example, you can use python Template. The template string would be your xml, with $waterTmp variables. You then call substitute(waterTmp=17) and your xml is done
Assuming that the receiving end of the xml() object in your sketch is a Pythin script, you might want to check that that one is started with the -u option to disabled buffered output. Usually only effects writes/prints to stdout but IMPE, you never know with Python...