Automata – Turing Machine Using Finite Control Memory to Solve Distinctness Problem

I am building a machine that recognizes the following element distinction problem and I also need the state transition diagram. I just realized that after comparing the first two strings and that you have already marked the first string with, say, "x". that this was checked, you lose the contents of the chain, so I was wondering how can we produce the stack on a state transition diagram?

For example, if I want to remember the contents of a string before overwriting it with a tape symbol, how to represent that in the diagram?

E = {# x1 # x2 # ··· # xl | each xi {0,1} * and xi = xj for each i̸ = j}.

As if x1 and x2 are not equal, then if they had one character in common, the first character of x1 would be marked x, but I want to remember that character for when I compare with x3. How can I represent the stack and then replicate the elements of the stack in a traditional state transition diagram.