So I wanted to install Ubuntu on USB, and I think I installed it to my 1TB hard drive instead. The hard drive has/had very important data on it, mainly family photos and work assignments...
Doing some research, I want to use testdisk to try and recover my data and I was wondering if I can recover them to the same hard drive as what was overwritten If that's possible?
First, DO NOT USE THE DRIVE FOR ANYTHING! at least until you decide what you want to do. Booting from it could allow the OS to start overwriting what may be left of your files. Other actions could cause problems too. It is probably best to leave it powered off (especially if it's a HDD) and disconnected from the system so that no disk clean up tool runs on it by mistake.
Byte Commander is mostly right. If you installed your OS on top of where you had your important data recovery is probably not possible, at least not on your own.
You might be able to get it back if you are willing to fork out a bunch of money for it. There are some recovery companies out there that use special equipment to try to read what was on the drive before it got overwritten. Look for a data recovery service that has the ability to do more than just run a software recovery (for example drive saver). If you want to try this DO NOT USE THE DRIVE FOR ANYTHING! Any writes that happen to the drive at this point will reduce the chances of getting the data back. There is also no guarantee you will get the data.
If the data is not worth spending money on you can try something like testdisk (as you suggested) or easeus or other recovery programs. I have not used either one myself and it's been a long time since I had to do a data recovery so do your research before you pick one.
If you have another disk to write the recovered files to that is also the safer option.
Please note I do not have a lot of experience in data recovery. so I'd be happy for someone else to answer but I know enough that I wanted to help where I can to avoid you doing something that could make it harder to get the data back.