This error means your code is crashing. Please enable display_errors to get the actual error message for more information:
Basically, if you delete a file, the file is deleted. If you don’t have a copy of the file yourself elsewhere, it’s gone forever.
The .cpanel, .softaculous folders are auto-generated. Deleting them means Softaculous doesn’t know about your installations anymore, but you can import them again through Softaculous.
The htdocs folder can simply be recreated through FTP or the file manager, and you can just upload your website files to them if required. But if your website is returning a 500 error, not a 404 error, you don’t need that particular htdocs folder at all.
The mail folder is not used for anything. No need to restore that.