Could anyone tell me why this is not working?
Well, you probably guessed this from GuruGary's correct response, but anyway here is an explicit answer to your question.
command ---> if not exist \\server\share\folder\%1.txt
tells BAT that if the file does not exist, do nothing
which is what will also happen if the file does exist.
After that command finishes doing nothing, it goes on to the next instruction.
command ---> echo cute message
So instead, you want to tell it to do SOMETHING.
command ---> if not exist \\server\share\folder\%1.txt (
tells BAT that if the files exists, do commands until ")" and if the file does not exist, skip everything until the next ")".
Mac
[Well, the parentheses can be nested, so interpret my word "next" in that context]