Im thinking about buying a 2007 f150 and taking out the 5.4 that it has and replacing it with an 2015-2019 6.7 diesel would it be a good idea I'm hoping it will fit
With modern vehicles, I would not do that - not worth it. You are going from one engine type to a completely different one, and it will have a ripple effect on the rest of the vehicle you have to account for: to name a few the electronics (including ECU and retuning), transmission, batteries, all the systems needed to run the Diesel engine properly, driveline, exhaust, suspension. You’d have to reengineer the whole car to make it run just right. That’s quite a project and money!
X2 on what DayWalker said. These days there is just too much other crap to deal with. When I was young it was no big deal since things were not as vehicle specific. I once saw a guy put (I think, this has been a long time ago) a 500 cadillac engine in his 1970s something Ford F-150. I believe he did it himself, and had no real issues (other than the engine taking up the entire engine compartment!). Regardless the engine was huge, and the biggest issue was probably the driveshaft. These days you have so much other crap to deal with, any major change is just not worth the headaches unless you are willing to change out electronics.
All that being said, something in me wants to take a Tesla Cyber truck and put a 350 (or larger) engine in it. Horrible idea, but something about that makes me smile.