I ran this deplorably ugly code on some test data and it seems that the variable !NUM! - which seems to be something gumbaz has devised for renaming a file in the event of a name collision - is being set to nothing (a blank) leading to a torrent of "ECHO is ON" messages and the variable being rendered literally rather than being expanded.
I mentioned about a week ago (on 26 Jan) that labels inside loops or other parenthetical structures are FROWNED UPON. I was ignored. The reason is that labels must be at the start of a line. The commands within the parentheses are really just one long line of multiple commands and the label ends up buried in the middle of that line. That code won't -ever- work.
Rather than repair this mess, I would call it a learning experience and start again, and this time I would:
Get the method and logic right and then write the code!