Is there any way to render this kind of template while preserving the double curly braces at the beginning and the end? If so I should be able to pass the output to node-red-contrib-home-assistant-websocket (api-render-template) directly and finaly achive my goal
I assume you are using the core Template node for this?
If you check the sidebar help for that node, it explains what to do if you need {{/}} to appear in the generated content:
If you need to use {{ }} within your content, you can change the characters used to mark the templated sections. For example, to use [[ ]] instead, add the following line to the top of the template: {{=[[ ]]=}}