Bash - How to print multi line strings (with '\n') using printf

Here's another variation.

printf '%s\n' 'first line here' 'second line here'

You can add an arbitrary number of arguments; printf will repeat the format string until all arguments are exhausted.

printf '%s\n' '#!/bin/sh' \
    'for x; do' \
    '    echo "Welcome to my script!"' \
    'done' >script.sh

Quoting the variable should do the trick. In your example, however, you are getting double newlines.

printf "$text_content"