How do I configure Time Machine to backup my Macs to iCloud?
You cannot officially back up a Mac to iCloud at this time.

If you want to write a program that does this, you could utilize CloudKit. This would be beyond the scope of a single Stack Overflow question, so I'll just link to the CloudKit documentation here:

https://developer.apple.com/icloud/cloudkit/