you need to declare char incomingArray[128]; outside loop() otherwise you get a new instance every time loop is called.
quick refactor, give it a try ( not tested)
int incomingByte = 0; // for incoming serial data
int x = 0;
bool moreData = true;
char incomingArray[128];
void setup()
{
Serial.begin(9600);
}
void loop()
{
if (moreData)
{
if (Serial.available()>0)
{
incomingArray[x] = Serial.read();
if (incomingArray[x] == '\0' || x == 127 ) // how to send a 0 char ? + added test array full !
{
moreData = false;
x = 0;
}
else
{
x++;
}
}
}
else // no moreData
{
Serial.println(incomingArray);
incomingArray[0] = '\0';
}
}