Mate, I know what bitwise AND, NAND, OR, NOR, XOR, XNOR operations/gatters are.
And I also get that you're "looping" on the same number.
However, it doesn't make any sense.
Why don't you do it from the outside-in or from the inside-out? See, it doesn't make any sense!!!
Benzo, XOR is a logic operation. XOR entails that if A = B, then output is 0. If A ≠ B, then output is 1. Look up basic logic gates and operations to know more.
The loop I performed was running the logic operation on the 1st and 2nd digits of the four-digit number, then on the 3rd and 4th digits, leaving me with a 2-digit number. Then I performed the operation on the 2-digit number, leaving me with a single digit.