3g/gps shield on mega 2560

  if (buttonState == HIGH) {
    //digitalWrite(ledPin, HIGH);

    int8_t answer;
    int onModulePin= 2;
    char gps_data[100];
    int counter;

     void setup(){

        pinMode(onModulePin, OUTPUT);
        Serial.begin(115200);

You can't define a function inside another function. You can't have two functions with the same name.