I had a Pokemon Sun save file that I had found on my SD card for my Nintendo 3DS. I transferred it over from the old card to the new one, and deleted the save from the newest SD card. I went back in and my old save wasn't there. I'm very upset about this and I don't know what to do.
I can only assume you are using the e-shop version and not cartridge. To my understanding, you were trying to transfer the save data from one SD card to another. To that, I say there is no need. If the SD card works, just use it. If not, a quick Ctrl + A, Ctrl + C is the most reliable method of backup.
If you have a new 3DS system or something of the such, you should be able to plop the old SD card into the new system. Once you log in and download Pokémon Sun, everything should be there.
Another bit of advice to you, do not delete anything until you know for sure that everything is working. This applies to everything you do. This way, if something goes wrong, you will still have the original files.
Unfortunately, I don't know exactly what you touched. If you are asking how to recover files, I'm sorry to say, they are gone for good. However, since it isn't clear what specifically you tried to move, there is a small chance that your issue is fixable. We will need more specificity than just "I transferred my save over from the old card to the new one."