ORA-12154: TNS: Could not resolve the connect identifier specified
In line 21:

SET DEFINE OFF


But you never re-enable it. When you run the script the 2nd time, substitution variables are not replaced with values provided by the user, because DEFINE is still OFF. Just add the below to the start of your script, so variables will be used in consecutive runs:

SET DEFINE ON