DateTime.Format() Documentation example causes exception
Attribution
Use:
system.debug(Datetime.now().formatGMT('yyyy-MM-dd\'T\'HH:mm:ss.SSS\'Z\''));
The esteemed Mr Ballinger also recommends the following, but it is wrapped in double quotes and slower, so I would probably not use it, myself.
system.debug(JSON.serialize(Datetime.now()));
You are linking into formats used in SOQL engine. Please refer to Apex reference and Java SimpleDateFormat for more advanced formats.