If you want to send string means you directly enter the string in serial.write(). while giving the string directly into the serial.write() then it will take that string as const char* not as a string type
Serial.write("hello");
Else you cannot send the string as directly in serial.write.you can use serial.print.use char array to send
Serial.write(MyString, sizeof(MyString));
Else you can send every char
void writeString(String stringData) { // Used to serially push out a String with Serial.write()
for (int i = 0; i < stringData.length(); i++)
{
Serial.write(stringData[i]); // Push each char 1 by 1 on each loop pass
}
}// end writeString
If you want to know more about the Data Science then do check out the following Data Science which will help you in understanding Data Science from scratch