If you have a Time Machine backup of your system then you have no need for the drive(s) inside the iMac. If you don't have a Time Machine backup that was a huge error and you will need to rectify that on your next Mac. To be honest operating any computer without a backup is shortsighted and a 100% guarantee of losing data!!! If you are not familiar with Time Machine please click Back up your Mac with Time Machine
If you do have a Time Machine backup, here are detailed instructions on how to migrate your data, apps and setting to a new Mac:
When you buy a new Mac the easiest, quickest and most reliable method to migrate from the old Mac to the new Mac is to simply connect the old Mac's Time Machine External Hard Disk to the new Mac using a USB cable before you turn on the new Mac. You will likely need a USB A to USB C adapter, you can find them on Amazon for $10 or less. When you start the new Mac for the first time it will startup Setup Assistant (SA), SA will get to a point where it asks if you are migrating from another computer, select Yes and follow the on-screen prompts and it's done! It is THAT simple.
If you have already done SA on the new computer then simply connect the Time Machine External Hard Disk using a USB cable and launch Migration Assistant (MA) which is located in Applications - Utilities - MA. Then follow the on-screen prompts.
The ONLY difference between MA and SA is MA will create a new user account that you need to log into.
Both SA and MA migrate applications (not 32 bit apps), data files & settings. They do not migrate Mac OS itself. Some professional apps such as Adobe and Microsoft apps may require re-installing their apps as they will not allow them to be migrated. As long as you kept the security keys for installing their apps, it is not an issue.
Finally, never EVER use Wi-Fi when doing Setup Assistant or Migration Assistant. Why, it simply fails in most cases. Please read and follow the directions in Setup Assistant and Migration Assistant. If you do not have a Time Machine backup of the older Mac then create one! If you are not aware of Time Machine, please read Back up your Mac with Time Machine and finally if you need an External Hard Disk to use as a Time Machine External Hard Disk then many experience users on these forums prefer the OWC Mercury Elite Pro due to it's reasonable price, high level of quality and ease of use.
If you do not have a Time Machine backup, please read further.
You will need to remove the HD from the 2015, forget about the SSD you cannot use it moving forward. To learn how to remove the HD please click the following link for a video that has instructions;
https://eshop.macsales.com/installvideos/imac_27in5k_14late_hdd/iMac15-1/