what`s the error?

where to put this code either on void loop or setup?? and I'm getting the error regarding function definition is not allowed here before '{' token.

String sendData(String command, const int timeout, boolean debug)
{
String response = "";
GSM8.print(command);
long int time = millis();

while ( (time + timeout) > millis())
{
while (GSM8.available())
{
char c = GSM8.read();
response += c;

wdt_reset();
}
wdt_reset();
}

if (debug)
{
Serial.println(response);
Serial.flush();
}

return response;
}

Please post a complete program

It's a function definition : it goes outside all other functions.

(Some might say "It uses Strings - it belongs in the trash can"..
Either way, it should be in code tags)

I dunno. Can you show your entire sketch, this part alone does not make sense. Please post the code between [code] and [/code] markup tags. Then post your entire error message the same way.

Thanks.