Hello all , I want your help in adding two consecutive msg.payload array[] and then finding running average for latest value + stored value

Welcome to the forum @developedbymayur

In order to make code readable and usable it is necessary to surround your code with three backticks (also known as a left quote or backquote ```)

``` 
   code goes here 
```

You can edit and correct your post by clicking the pencil :pencil2: icon.

See this post for more details - How to share code or flow json

To debug your code you can add node.warn() statements to show intermediate results in the debug pane. For example, after the total += line you could add

node.warn(`total = ${total}`)

By using that technique you can follow the flow through and see where it is failing.