write file sub