File writing all contents of array with forloop.