In your actually command, why are you using $0 and not $1? Wouldn't $1 take the command line name of the file (ABC.out) and move it? It seems like your mv command would be attempting to move the script.
You consistently provide great answers, so I'm sure it's something simple I'm overlooking... I was just curious.