Function to add a node

I want to create a dashboard that shows me a chart with some temperature sensors, but I want to be able to add new sensors, that means I need to add more mqtt nodes that recives the information from the sensors, so I want to call a function that can add new nodes and fill taht information

You will need to investigate the admin API in the Node-RED documentation. It should let you install new nodes. Whether it will let you configure them is another matter.

However, if you structure your MQTT topics correctly, you shouldn't need to do this at all. Instead you can use a wildcard topic for your mqtt-in node like SENSORS/# or maybe TEMPERATURE/# which will pick up all of the messages for those topic hierarchies. You can then use a switch node or other processing - clever use of an Angular template with ng-repeat for example - to display the data.