Alright so I managed to get it to work without losing any data. Here are my steps.
Get an external drive. (SSD) is preferred.
Power on Mac then hold Shift, Options, Command, and R. This should bring you to a screen with a spinning globe and will ask for the wifi password.
Plug your external drive into the Mac and go to disk utility.
Click on view on top left and click show all devices
Click on your external drive and click erase. Select the following options before clicking erase again: Whatever you want to name your drive, APFS Format, GUID Scheme.
Click Erase
Afterwards go back to the macOS utilities page and select Reinstall macOS.
Accept the terms and conditions and then select the external drive as a boot device to download the OS to.
Then just wait for it to finish and then boot up following the instructions indicated.
Once in, go to Finder and then select Macintosh HD Data and navigate to user and then just open your desktop or documents folders to access your files.
Copy everything to another external device like a USB stick if the files are small in size.
Then remove at least 15gb of space remaining and turn off your laptop
Boot on your laptop again and hold the same key combination as mentioned before: Shift, Options, Command, R.
This time reinstall macOS to the Macintosh HD drive. There should be enough storage to do this. Otherwise delete more files.
Then the OS should be installed on your laptop and your external drive is no longer needed.
You now have your laptop back and your files saved.
Good Luck.