You should use some system that unlocks levels by number. And remember only that number. So initially this number will be 1, and only 1st level opened. When player finishes 1st level, you sill set it to 2, and so on.
With this you will construct levels selection screen by some loop, where saved number of opened levels used to set first N levels as opened, and other as locked.