Once you erase everything using disk utility you will need a rebootable USB with the latest operating system on it which is Big Sur. Once you've done that you'll have a clean Macbook
https://www.imore.com/how-do-clean-install-macos
If it doesn't give you the help you need there is plenty of info via Google.