You just need to design a structure for your file that will allow you to write the data such that you can read it back and re-create the memory content. If your data is fixed size then you can just write in fixed length blocks, if it is variable then you need to write control fields at the beginning of each record to show how long it is. For example a simple structure would be something like:
Word0 : record type, some value indicating the content of this record.
Word1 : length, the size of the following data in bytes, or words as appropriate.
Word2 to N : data content
// repeated for all data
Then to write your file you just need to go through all the data in memory and for each item, write the control word, followed by the length, followed by the actual data. The last record should be followed by a control word that indicates end of data. Reading it back into memory is just the reverse of this process.