need help as iam newbee this programe is hanging on the middlle some times runs

nazeem:
as said program :

when input 1 is low
the output 1 should go high for delay 1000ms and to low state

Do you mean "when input 1 GOES low?". That's not quite the same thing.

void loop() 
{   
  val1 = digitalRead(switchPin1);
  delay(50);
  if (val1 == LOW) {
...

That will do whatever thousands of times a second, whenever val1 is low. Is that really what you want? Or do you mean, when it WAS high, and is NOW low? If so, you didn't do that.