One of the main sites to use would be the following:
• What to do before you sell, give away, or trade in your Mac - Apple Support
https://support.apple.com/en-us/HT201065
Another suggests how to Erase and Install a newer or newest
operating system (download installer, for internet install -or-
start from Recovery partition and download newer files online.)
Step #7 in above, is where your Mac should try & go.
Erase your hard drive and reinstall macOS
The best way to restore your Mac to factory settings
is to erase your hard drive and reinstall macOS.
This also can be useful to ready the new Mac OS for new owner.
"After macOS installation is complete, the Mac restarts to a setup
assistant that asks you to choose a country or region. To leave the Mac
in an out-of-box state, don't continue setup. Instead, press Command-Q
to shut down the Mac. ~ When the new owner turns on the Mac, the
'setup assistant' guides them through the setup process."
Depending on where the Mac was upgraded to, and original macOS
you may need to begin even earlier. Hopefully it had already been
upgraded or shipped with later Mac system, & not need DVD installer.
Good luck & happy computing!🌞🐝