Limit switch with Nema 17 and A4988

Thank so much , i do done with this code

const int dirPin1 = 5;
const int stepPin1 = 4;
const int lmswitch1 = 2;
const int lmswitch2 = 3;
const int enPin = 9;


void setup()
{
  // Declare pins as Outputs
  Serial.begin(9600);
  pinMode(stepPin1, OUTPUT);
  pinMode(dirPin1, OUTPUT);
  pinMode(lmswitch1 , INPUT_PULLUP);
  pinMode(lmswitch2 , INPUT_PULLUP);
  pinMode(enPin, OUTPUT);
  digitalWrite(enPin, LOW);
  digitalWrite(dirPin1, HIGH);
}
void loop()
{
  int fwdend = digitalRead(lmswitch1);
  int backend = digitalRead(lmswitch2);
  if (fwdend == HIGH ) {
    digitalWrite(stepPin1 , HIGH);
    delayMicroseconds(2000);
    digitalWrite(stepPin1 , LOW);
    delayMicroseconds(2000);
  } else if (fwdend == LOW ) {
    digitalWrite(dirPin1, LOW);
  }
  if ((backend == HIGH ) && (digitalRead(dirPin1) == LOW)) {
    digitalWrite(stepPin1 , HIGH);
    delayMicroseconds(2000);
    digitalWrite(stepPin1 , LOW);
    delayMicroseconds(2000);
  } else if ((backend == LOW ) && (digitalRead(dirPin1) == LOW)) {
    digitalWrite(dirPin1, HIGH);
  }
}