Fix escaping and spacing issues with templates.

- Fixed indentation for embedded scripts
- Fixed escaping in the `error_exit` function that was causing a failure
  in create stack.