How can I run the below program as many times as I want?(for linear actuator)

Please see the program below. It is for a linear stage actuator
The number of cycles should be as per my command. I will input the digit and the loop should run that many times.
Please advise, how to do that!

:
#define dirPin 2
#define stepPin 3
#define stepsPerRevolution 1600
// put the distance(x=? in mm) you want to move backward:
int x=10;

//put the distance (y=? in mm) you want to move forward:
int y=10;

void setup() {

pinMode(stepPin, OUTPUT);
pinMode(dirPin, OUTPUT);
}
void loop() {

delay(100);

digitalWrite(dirPin, HIGH);

for (int i = 0; i < x* stepsPerRevolution; i++) {

digitalWrite(stepPin, HIGH);
delayMicroseconds(10);
digitalWrite(stepPin, LOW);
delayMicroseconds(10);
}
delay(100);

digitalWrite(dirPin, LOW);

for (int i = 0; i < y * stepsPerRevolution; i++) {

digitalWrite(stepPin, HIGH);
delayMicroseconds(10);
digitalWrite(stepPin, LOW);
delayMicroseconds(10);
}
delay(100);
}

Please advise, how to do that!

One way would be to put the required code in a function and use a for loop to call the function as many times as required

Getting the user input could be as simple as using Serial.parseInt()

Please follow the advice on posting a programming question given in Read this before posting a programming question

In particular note the advice to Auto format code in the IDE and to use code tags when posting code here as it prevents some combinations of characters in code being interpreted as HTML commands such as italics, bold or a smiley character, all of which render the code useless

Check out this tutorial for serial input:

Serial Input Basics

Everyone makes the same mistake: doing the interesting bit first. The right way is to do the boring bit first. Start a new sketch where you "input the digit". Have that sketch use Serial.print to just say "the actuator should now run X times". Once you are inputting the digit the way you want and getting that overall control structure correct, then put in the bits to run the actuator.

Suggest you use a stepper library like AccelStepper and do the steps one at a time so your loop stays responsive for other stuff.
See my tutorial on Simple Multi-tasking in Arduino for a stepper example driven by user commands

See this post for a code example that reads and converts numbers
https://forum.arduino.cc/index.php?topic=719303.msg4835951#msg4835951