You need to follow the procedure for resetting the computer to factory state.
What to do before you sell, give away, or trade in your Mac
Factory reset of your Mac - Apple Support
You need to perform an Internet Recovery:
Internet/Network Recovery of El Capitan or Later on a Clean Disk
- Restart the computer. Immediately, at or before the chime, hold down the (Command-Option-Shift-R) keys until a globe appears.
- The Utility Menu will appear in from 5-20 minutes. Be patient.
- Select Disk Utility and click on the Continue button.
- When Disk Utility loads select the target drive (out-dented entry w/type and size) from the side list.
- Click on the Erase button in Disk Utility's toolbar. A panel will drop down.
- Set the partition scheme to GUID.
- Set the Format type to APFS (SSDs, only if installing Mojave or Catalina ) or Mac OS Extended, (Journaled.)
- Provide a volume name, usually "Macintosh HD."
- Click on the Apply button, then click on the Done button when it activates.
- Quit Disk Utility and return to the Utility Menu.
- Select Install OS X and click on the Continue button.
This should install the original version of macOS that came pre-installed from the factory. Upon completion of the installation you will see a gray screen with a list of countries. At this point shut down the computer. Do not go any further.