write the next prime to the file and update array index i

fprintf(fr_ptr,"%d",a[i]);

i--;