Thanks everyone for the feedback!
To clarify, this file is not meant to run with the WHMCS hooks system as there is no add_hook() function call being made, so placing it in the /includes/hooks directory may not work.
This file was meant to be a one-off solution to be used for removing the mass spam clients that were being created. In order to use it properly, you would simply place the file in your WHMCS root directory and then access the file from your browser to run it.
It should provide you with the output of what clients were able to be deleted or which clients were not (if any). You can run the script as many times as needed until all of the spam clients have been removed.
When you are done using the script, it should be removed from the server as it does contain code that destroys data (deletes clients). It shouldn't ever be an issue, but to be safe it is good practice to remove utility scripts when they aren't needed anymore.
As always, please remember to take a database backup before using this tool.