@Carl Love Thank you for your answer, Carl. Now that I understand the cause of my problem, I would like to ask something more specific. Suppose I have a set S whose elements are lists [a,b,U] where a,b are integers and U is a MultiSet (the elements of U are lists [a',b',U'] of the same type, and so on recursively). Because of the phenomenon that you explained, my set S will contain many repetitions. Is there a way to remove repetitions (understandable by someone who is not very knowledgeable in Maple)?
Regarding the issue with the file saving, I tested your theory with your mini-example and it worked fine (no error message). I tried again with my original example and got an error message different from the one I mentioned in my question. More precisely, at the end of the file displayed in my question, I did this:
save X, Y, "saveXY.m";
and Maple replied this:
[2, 7, Object<<MultiSet,4487021344>>]
Error, (in MultiSet:-ModuleCopy) too many levels of recursion
Any thoughts? Thanks again.