added api write file