There should be no difference in the way the code executes.
There CAN be a difference depending on how a function/lisp routine works and/or how well (or bad) is was written. Like global variables that shouldn't be global & mess up on the 2nd and following runs.
As for the dialogs poping up, that too should happen if you execute the code directly on 1 drawing (unless some where turned off by sysvar's like filedia), not just when running a script. (looking at the code, it should indeed)
The answer is indeed that it should work fine, but your code is a bit off.
(defun c:test nil
(command "_.Purge" "_All" "*" "_No"
"_.-purge" "_R" "_All" "_No"
"_.Setbylayer" "_All" "" "_Yes" "_Yes"
"_.Layer" "_Color" 253 "*" ""
"_.Audit" "_Yes")
(command "_.SAVEAS" "2013" (strcat "\\\\universal-5010\\S\\ENGINEERING\\JOBS\\16-006 GM Ramos\\DRAWINGS\\GK\\GK XREF\\" (getvar "dwgname")) "_Yes"))
The first line calls _.Purge, this should be like the second line: _.-purge (its the - that indicates you don't want the dialoged version, note: Not all commands come with a - variant)
Same goes for _.Layer -> _.-layer
I'm not sure about that defun... it might work as is, but usually people use: () instead of nil
& as a tip: Do not call your function "test". Before you know it you got 10 different "test" functions loaded, all in conflict and overwriting eachother and you don't know which is active. Besides not being able to tell what it is, a few months from now. Try to use unique names that are relevant, somewhat. Like you did with the purge.txt (why not .lsp ?) instead of test.txt (of course, you can't name it c:purge as that's an existing command (well, you can, but that would redefine the existing purge command, which you do not want))