Saving data inside a loop


I have written in FreeFem++ a central differences scheme to the weak formulation of the 2D wave equation in a square. and initialized it with two initial conditions, then I have a loop for the time of the simulation, hence in each time of the simulation t is known and u^n-1 and u^n are given to scheme and u^n+1 is calculated, I wanted to ask, please how can I save the data of u^n and u^n+1 for each time of the simulation in an array or in a file.


Real [int,int] data(nt,m):// nt: mesh of Time , m: degree of freedom (numbers of nodes in the mesh)
// m=Vh.ndof;
for(t=0;I<t;t++) //t : times