If you’ve trashed a file and then realized you need it, you can recover it if you haven’t emptied the Trash. Just open the Trash folder and drag it out. If you’ve emptied the Trash and are using Time Machine to make regular backups, switch to the Finder, then open Time Machine, and use the arrows at the bottom-right of the screen to “go back” to a point when you know you had the file.
Locate the file, click on it, and hit Restore. For other backup software, refer to its manual to find out how to recover a file. Not running regular backups? Set up a regular schedule now. At least two: both on and off-site. It isn’t time to panic yet. Trashed files aren’t deleted from your drive, but their entry in the directory is removed and the space made available to be overwritten. As soon as you realize you need the trashed file, stop using your Mac for anything that’s not necessary to recover the file.