If your iMac has a Hard Drive or a Fusion Drive instead of just an SSD, then Apple's instructions fall short of securely erasing all your data from a Hard Drive. A Hard Drive requires that every part must be overwritten with a "secure erase" option in Disk Utility.
Or you first need to enable Filevault on the Hard Drive or Fusion Drive. Once the Filevault encryption process has completed....it may take several days with the iMac running 24/7 before the encryption process completes depending on the size & health of the Hard Drive. After the Hard Drive is encrypted, then the instructions provided in the Apple article linked by @den.thed will be sufficient.
If your iMac only has an SSD for internal storage, then the Apple instructions @den.thed provided is sufficient since SSDs work differently than a Hard Drive (or Fusion Drive).
It is unfortunate Apple has such a glaring oversight.
If you have