Will I have to plug in an external hard drive to my iMac to use time machine = if i buy a 4TB drive can i just unplug from iMac and plug into mac book to back that up and will it keep both back ups separate?
I would partition the external drive.. so if you buy 4TB which is a good size..
IMHO don't buy 2.5" type above 2TB as they use SMR format and very slow.. see more below.
Get desktop drive which have 3.5" drives in them.. partition into two parts and you can backup one Mac to first partition and one Mac to the second partition. That keeps the two Macs entirely separate.
Would it be best to get 2 X 2TB external drives one-for each mac?
I do like keeping the drive connected.. and 2TB you can buy portable drive.. so in the iMac it will be invisible and powered over USB.. easy. It also means the if one drive fails you still have one backup whereas the one backup drive fails and you have lost all the backups.
In a way it depends on how you use the Macbook. Personally I prefer to do network backups on them over wireless just for automatic backup without user intervention it works better. I don't like plugging and unplugging something every day..
If your Macbook is running to a dock though, you can plug in one connection and that makes it easy.
How does CCC work, I presume you download it on each mac and store the CCC on a hard drive somehow?
CCC is an application.. you download and install it.
Do i need to purchase for each mac?
Is it a yearly cost or a one off cost?
One license is permanent (only need to upgrade license for new version.. patches are free for current version) and you can use on as many computer in your home as you have on one license so it is pretty reasonable.
There are alternatives which are also popular.. superduper being one well known and popular.
I find CCC more functional and better support.
Download it for free and use it for a month free without any limitations. That gives you a chance to learn how to use it and decide for yourself.
My setup is CCC once a day to USB drive. This is bootable clone so I can check the backup every now and then by booting the computer from it. I do still run Time Machine to help people with questions but I trust it not at all.
It regularly wipes itself out. After several years of this I wised up. CCC has never let me down.
I do run Time Machine to several targets.. a second partition on the same external drive as CCC bootable clone.. that is the best for TM. I run it to a Time Capsule.. for old times sake.. and a Synology NAS which is also very good.
CCC is different and you can follow the setup tutorial.
https://bombich.com/kb/ccc5/how-set-up-your-first-backup
There are also youtube tutorials. You won't find it hard.. interface is very clean and best of all the logs.. just click on task history on the main screen and you can see the list of backups.
If you are going to backup Catalina.. there is some important info to note.
If your backup disk is a "mobile" 2.5" rotational disk (i.e. that spins at 5400RPM or less), we recommend that you format that device as "Mac OS Extended, Journaled" (aka HFS+) and use it for data-only backups. APFS offers unacceptable performance on these devices, we simply can't recommend nor support the use of these devices for bootable backups.
https://bombich.com/kb/ccc5/frequently-asked-questions-about-ccc-and-macos-catalina
https://bombich.com/blog/2019/09/12/analysis-apfs-enumeration-performance-on-rotational-hard-drives
CCC has extensive and excellent KB articles and support if you ever need it.
NOTE I have no affiliation to them and pay for a license same as any other user.