Make sure to perform the steps mentioned in the following Apple article to remove your personal data & information from the device:
What to do before you sell, give away, trade in, or recycle your Mac - Apple Support
Make sure to first enable Filevault & let the encryption process complete before actually erasing the internal drive. This is especially important if the computer uses a Hard Drive (or Fusion Drive). If it is just an SSD, then a simple erase is fine since SSDs work differently than a Hard Drive. Unfortunately Apple has forgotten many people still have older computers which still have a Hard Drive in them & need more than just a simple erase in order to overwrite & destroy all access to your old files stored on that drive.
If it is an Intel Mac, then I can recommend a third party bootable USB option (free) which can overwrite everything on the Hard Drive.if you don't want/need an OS on that system afterwards.