write2 function

write2