You need to make sure to use a save game object to store your variable or it won’t persist between the levels. You could save the location the player leaves at as a string for example and then use a switch node to select the appropriate spawn location in the new level. There may be a simpler way to do this but this is the gist of it.
