Two msg in delay with function node

Aside from the delay issue (for which you should use something like the Delay node), your example won't work in a Function node because the first payload gets overwritten. I suggest you read up on using Functions ... https://nodered.org/docs/user-guide/writing-functions.

An uncomplicated flow would be: Inject ->Function ->Delay ->Function -> Delay -> Debug

Alternatively,have a read of Can I have a delay / sleep inside Function node