It depends on whether this laptop uses an SSD or a hard drive. If it has an SSD and you erased it, then the data is gone. If it has a hard drive and Filevault was enabled on it before you erased it, then the data is gone.
If it uses a hard drive without Filevault being enabled prior to the erase, then the data can still be accessed with a data recovery program. You can overwrite the whole hard drive by writing zeroes to every sector by creating & using ShredOS. You can use the downloaded ShredOS .img file as a source for Etcher (Mac/Windows/Linux) which will make a bootable ShredOS USB stick for you. You just need to download the correct file according to the model of the laptop. Most Apple laptops whose model is 2007-2012 can use the 64 bit version. The first generation Intel laptops from 2006 and early 2007 require using the 32 bit version.
https://github.com/PartialVolume/shredos.x86_64
FYI, it is always recommended to post the exact model of a Mac when asking for help since there are so many different models out there. You can get the exact model by clicking the Apple menu and selecting "About This Mac", or by entering the system serial number here if the Mac cannot boot into macOS or Safe Mode:
Check Your Service and Support Coverage - Apple Support
Here is an Apple article on how to prepare a Mac for sale (it assumes the computer uses an SSD or has Filevault fully enabled):
What to do before you sell, give away, trade in, or recycle your Mac - Apple Support