In FreeFem++, is the .sol solution file read in the order it was stored?

I want to save the reference solution as a .sol file and read it when calculating errors. May I ask if the data is read in the same order as it was stored?

Yes, sure.
The data are written line after line in the file. Each writing adds one line at the end of the file.
Similarly, each reading takes one line (first reading takes the first line of the file, the second reading reads the second line, and so on).
This is valid as long as you remain in the same group of {} where the read/write command has been defined. If you leave the group and reenter later at execution, you restart the reading/writing at the beginning of the file.
If you want to continue to write or read in the same file, you need to put the ofstream/ifstream command out of the {} in such a way that it is run only once.