Excaped the variable when writeing lines to files