Clear existing array when getting new serial command
To clear an array you would do:

for( int i = 0; i &lt; sizeof(data);  ++i )
   data[i] = (char)0;


or

memset(data, 0, sizeof(data));


, which does the same thing using a library function.

However, because strings of characters (not referring to 'String' objects here) are terminated by a zero byte, only the first byte needs to be zeroed: 

data[0] = (char)0;


will do it.