Is there a possible way to recover a backup that i deleted from iTunes? When I tried to restore my iPhone from iTunes, it would give me an error code. So, I went into preferences and deleted the backup, thinking its just some cache that might be generating the problem. Is there some program or way to recover the deleted backup?
You'll have to use a third party solution to attempt to recover that backup file. Third Party solutions usually don't work well, so if you do take a chance with it, you can keep that in mind.

EaseUS has a recovery option - https://www.easeus.com/file-recovery/recover-deleted-itunes-backup.html

If you are on a Mac and have a Time Machine backup, it keeps backups in this directory:

~/Library/Application Support/MobileSync/Backup