gather write data into common arrays and write at end.