If you intend to replace the computer of course you can buy a new one but there are some things that can help you if you think you cannot afford a new one. First is, Apple offers no-interest financing with the AppleCard. Also, did you know Apple has a refurbished store which has ZERO downside? Apple refurbished Macs are only available directly from Apple and can be found at www.apple.com, just navigate to the bottom of the page and click the Refurbished store. Refurbs are identical to new, come with the same warranty as new, are eligible for AppleCare and can save hundreds of $$$. Also, note you are not limited to an iMac you can select any Mac that is currently available. If you can't find what you want then check often as inventory changes very quickly.
If you still cannot afford to buy directly from Apple then consider a used Mac. If you buy used, please do yourself a favor and only buy from a trusted source such as Macsales.com. NEVER EVER purchase from E-Bay, Craigslist, Marketplace, your local PC computer store, your best buddy friend (you know what I mean, right??). Be safe and be smart, if you don't have enough money right now then continue to save. This strategy pays off!!
Finally, yes you can remove the old Macs HD and place it in an enclosure to migrate your data. Simply get a good quality enclosure (OWC Mercury Elite Pro) and put the drive in there. Then follow the instructions below once you have the 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 (or the drive from your old machine in an enclosure) 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 as you can use that same drive on the new computer. 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.