Firstly, its unlikely the vertical lines are a direct result of the HDD replacement. It is much more likely that the VDU cable has been damaged, dislodged or simply requires replacement, this is standard procedure with screen removal in MacBooks and I imagine with iMacs as well.
When you say "spinning balls" I'm trying to get this straight in my head, so you now have a 2019 iMac, you have installed a 2017 SSD into it and you get spinning balls.
Are you sure that the SSD from the 2017 model is compatible with the 2019 model? If so bear in mind the spinning balls could also be a likely result of faulty or insufficient RAM, in fact it's more likely the cause.
As for migrating your data from one SSD to the other there are three possible ways; From a Time Machine Backup (cheapest and most popular), by purchasing a USB external HDD/SDD drive housing and restoring from that or probably least likely, from device to device via Network connection if you could get both of them working.
The screen is not likely a software problem, more likely GPU or Screen connection issue so, creating a full Time Machine Backup from either device is entirely possible but not if you have faulty or insufficient RAM chips.
My advice would be to replace the RAM chips in the device of your choice with a minimum total of 16GB. Purchase a USB external HDD/SDD drive housing and Start up the iMac from that (Pressing the option key on startup). Make a Time Machine backup of the start up SSD on a seperate EHD. Instal a new copy of the latest macOS that the internal drive can take from the App Store restart from the internal Drive which should open with the "Welcome Screen" then during setup choose the Time Machine backup as the source to restore your data from.