Yes, you should sign out of iCloud to ensure that none of your personal data remains on the Mac after erasing it.