To perform a clean install of macOS you need to boot the laptop to Recovery Mode (Command + R), Internet Recovery Mode (Command + Option + R), or from a bootable macOS USB installer. Once booted to the macOS installer launch Disk Utility and erase the physical drive as GUID partition and MacOS Extended (Journaled), or as GUID partition and APFS (top option) if the latter is available as an option. You may need to click "View" within Disk Utility and select "Show All Devices" so the physical drive appears on the left pane of Disk Utility. After successfully erasing the whole drive, quit Disk Utility and select "Reinstall macOS". This is only for Intel Macs.
If you have a 2018+ T2 Mac or M1 Mac, then you probably should "Restore" the firmware which requires access to another Mac running macOS 10.15+ as this will perform a clean install of macOS and also clear out & refresh the T2 security settings.
Revive or restore an Intel-based Mac using Apple Configurator 2 - Apple Support
Revive or restore a Mac with Apple silicon using Apple Configurator 2 - Apple Support
FYI, here is what the previous owner should have done prior to selling the Mac:
What to do before you sell, give away, or trade in your Mac - Apple Support
In the future when asking for assistance on these forums, please provide the exact model of your Mac since each model has their own unique issues and resolutions.