Hi,
please read this post about how to properly share flows in the forum - How to share code or flow json
You are getting the core Template mixed up with the Node-RED Dashboard UI-Template node.
The core Template node uses the mustache syntax to generate text based on the message passed to the node. You are returning that text in response to an HTTP request. So the browser will handle that response as HTML and display it - but there is no special link between what is in that page and the flow.
The sort of syntax you are trying to use is what you would use in the Node-RED Dashboard UI Template node in order to handle messages passed to that node. This node can only be used in the context of Node-RED Dashboard - you can't use it in your own page outside of the dashboard.
If you want to generate a page that can send/receive messages from a Node-RED flow, without using Node-RED Dashboard, (or any of the other dashboard modules such as ui-builder), then you'll have to create the comms link between the page and node-red yourself, such as with a WebSocket connect.