Just got new iMac, came with time machine. Started off OK until I got message 'unable to complete back up'
Is that the entire message? There should be another phrase to it. See #C3 in Time Machine - Troubleshooting. It will show you how to locate the message(s) that describe the problem, then help you fix it. If that doesn't help, post back with details, including all the messages, what you've done, and the results.
You are backing up to a Time Capsule, right? If not, please clarify.