moving write to file