When configuring a router, always keep in mind that the configs are stored in runtime mode. The configs will be saved once you run the command to save the router or switch configurations.
Here are the different methods to save the router configurations:
Save router and switch configurations
By default, the startup configurations of a router or switch are stored in NVRAM. More precisely, in a file called startup-config.
The running-config file is stored in the RAM memory.

After finishing with the configurations of a router or switch, there are two commands to save the configurations:
copy running-config startup-config
write memory
The copy running-config startup-config command is recommended during exams.
This command (copy running-config startup-config) copies the contents of running-config to startup-config.

The write memory command also allows you to quickly save the configurations of a router or switch.

The shortcut is write or wr.