Made the grid to record data at the end

I have changed the gird to 3x2 for easier testing.

It is only able to write to a one designated file. < need to improve