(very newbie) "assembling" a message to be sent

I tried a very simple flow. I connected the stepper via USB and it works, so I have a starting point.

image|690x383

I have problems with the checksum. I tried a for loop but it caused the flow not to respond, so i summed the 0-7 bytes at once. You can see for loop, which is commented, so that you can see where is the error.

var buf1 = Buffer.alloc(9);

buf1[0] = 1; // module address
buf1[1] = 4; // command(4: move to position...)
buf1[2] = 0; // command type (0: absolute position; 1: relative position)
buf1[3] = 0; // motor num

buf1.writeInt32BE(msg.payload,4); // bytes from 5 to 8 correspond to command value (position in steps)

//var checksum = buf1[0];
//var i;
//for(i=1; 1<8; i++)//
//{
//   checksum = checksum + buf1[i];
//}
// buf1[8] = checksum;

buf1[8]= buf1[0] + buf1[1] + buf1[2] + buf1[3] + buf1[4] + buf1[5] + buf1[6] + buf1[7] + buf1[8];

var msg1 = {payload: buf1};
return msg1;