Hi, in order to make code more readable and importable it is important to post it between two sets of three backticks - ``` - see this post for more details - How to share code or flow json
Your code is currently unreadable - please edit your post.
Secondly,
Read this the documentation on functions it tels you about sending multiple messages
Basically, its doing what you asked. (if you want 1 mesage for each output, remove the outer array e.g.
//return [ outputMsgs ]; << for sending multiple as per docs
return outputMsgs ; // << for sending 1 per output