first, you should make a new blueprint based on GameInstance, called something like MyGameInstance. you can add any variables you want to keep between levels to that blueprint’s list of variables. then, under Edit > ProjectSettings > Maps and Modes > at the very bottom, you can set the Game Instance Class to your custom MyGameInstance.
then when you use GetGameInstance inside a blueprint, you can cast to MyGameInstance, and set or get its variables.