You can use newlines and apply css to allow pre formatted white space for a text node.
Or simply do it in a dashboard 2 template node
e.g.
[{"id":"2578f97fb93bc8c6","type":"inject","z":"d1395164b4eec73e","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"\"message \" & $ceil($random()*100)","payloadType":"jsonata","x":170,"y":4540,"wires":[["6c14e438223505cc"]]},{"id":"6c14e438223505cc","type":"change","z":"d1395164b4eec73e","name":"","rules":[{"t":"set","p":"payload","pt":"msg","to":"$append([$$.payload], [$flowContext(\"display_text\")])[[0..4]]","tot":"jsonata"},{"t":"set","p":"display_text","pt":"flow","to":"payload","tot":"msg"},{"t":"set","p":"payload","pt":"msg","to":" $join( $$.payload, \"\\n\")","tot":"jsonata"}],"action":"","property":"","from":"","to":"","reg":false,"x":360,"y":4540,"wires":[["4189ed91221ed19e","0d9c124d685ae12c"]]},{"id":"4189ed91221ed19e","type":"debug","z":"d1395164b4eec73e","name":"Post-Debug","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","statusVal":"","statusType":"auto","x":570,"y":4560,"wires":[]},{"id":"0d9c124d685ae12c","type":"ui-template","z":"d1395164b4eec73e","group":"9d83cd8b3d5ee33c","page":"","ui":"","name":"","order":0,"width":0,"height":0,"head":"","format":"<template>\n <div>\n <h2>Messages</h2>\n <p class=\"my-class\">{{msg.payload}}</p>\n \n \n </div>\n</template>\n\n<style>\n /* define any styles here - supports raw CSS */\n .my-class {\n white-space: pre;\n }\n</style>","storeOutMessages":true,"passthru":false,"resendOnRefresh":true,"templateScope":"local","className":"","x":460,"y":4480,"wires":[[]]},{"id":"9d83cd8b3d5ee33c","type":"ui-group","name":"Group1","page":"c694d0ebe0d2b702","width":"6","height":"1","order":2,"showTitle":true,"className":"","visible":"true","disabled":"false"},{"id":"c694d0ebe0d2b702","type":"ui-page","name":"Page1","ui":"1805777f90e92057","path":"/page1","icon":"home","layout":"grid","theme":"a965ccfef139317a","order":-1,"className":"","visible":"true","disabled":"false"},{"id":"1805777f90e92057","type":"ui-base","name":"dashboard","path":"/dashboard","includeClientData":true,"acceptsClientConfig":["ui-notification","ui-control"],"showPathInSidebar":false},{"id":"a965ccfef139317a","type":"ui-theme","name":"HN Theme","colors":{"surface":"#5c5c5c","primary":"#00fdff","bgPage":"#383838","groupBg":"#4f4f4f","groupOutline":"#858585"},"sizes":{"pagePadding":"12px","groupGap":"12px","groupBorderRadius":"4px","widgetGap":"12px"}}]
The change node stores the messages and formats the text, it is set to 5 and adds the newline to the top.