HOW TO COMBINE 2 DIFFERENT SKETCH?

This is the 1st sketch

#include <Servo.h>
const int switchPin = 2; //active low
const int servoPin = 10;
int oldButtonState;
int state, oldState;
Servo myservo2;

void setup()
{
pinMode(switchPin, INPUT_PULLUP);
servo.attach(servoPin);
}

void loop()
{
int buttonState = digitalRead(switchPin);
if (buttonState == LOW)
{
if (oldButtonState == HIGH)
{
state = !state; //toggle state
}
}
oldButtonState = buttonState;
if (state != oldState)// changed state
{
if (state == 1)
{
servo.write(0); // HIGH (switch is off)
delay(500);
}
else
{
servo.write(180); // LOW (switch is on)
delay(500);
}
}
oldState = state;
}

This is the 2nd sketch

#include <Servo.h> //include the servo library for this program
Servo myservo; //create servo object to control a servo

void setup() //do these things once
{
Serial.begin(9600); //set data transmission rate to communicate with computer
pinMode (13, OUTPUT); //LED pin 13
pinMode(8,INPUT_PULLUP); //pin 8 forced to HIGH when there is no external input
myservo.attach(9); //attaches the servo on pin 9 to the servo object
myservo.write(60); //tells servo to go to 60 degree position
}

void loop() //do these things forever
{
while(digitalRead(8) == HIGH) //as long as pin 8 is HIGH,…
{
digitalWrite(13, HIGH); //LED turn On
myservo.write(60); //…servo position is 60 degrees
Serial.print(“open”); //print the word “open”
Serial.println(""); //print nothing, go to next line

}
digitalWrite(13, LOW); //LED turn off
myservo.write(150); //otherwise, servo position is 150 degrees
Serial.println(""); //print nothing, go to next line
Serial.println(“closed”); //print the word “closed”
Serial.print(“waiting 5 seconds”); //print “waiting 5 seconds”
Serial.println(""); //print nothing, go to next line
delay(5000);

}

Have you been here yet?http://forum.arduino.cc/index.php?topic=258240.0

You also need to read the "How to use this forum" thread. There is info in there on how to properly post code and how to ask questions so they get answers.

You need to specify what the combined code has to do. As a first measure, you have to get rid of the delays.