coding help

I need help to make below flow

Move Disk (PUL=9, DIR =8)
If pin 21 is High
Stop DISK
Set pin 10 HIGH then LOW
Move Motor1 (PUL=7, DIR=6) for 5 seconds
Stop Motor1
Set pin 3 High for 1 second
Move Motor1 (PUL=7, DIR=6) for 5 seconds
Set pin 3 High for 1
second Set pin 3 High for 1 second
Start over again even if pin 21 is HIGH (it will go LOW once disk moves)
If pin 21 is LOW
Move disk
i tried below coding but not stable

#include <Stepper.h>

int PULD = 9; //define Pulse pin
int DIRD = 8;//define Direction pin
int DIRT = 6;
int PULT = 7;
int VLV1 = 3;
int ORG = 2;
int val;
int IR = 21;
int sp;

void setup() {
pinMode (PULD, OUTPUT);
pinMode (DIRD, OUTPUT);
pinMode (PULT, OUTPUT);
pinMode (DIRT, OUTPUT);
pinMode (VLV1, OUTPUT);
pinMode (ORG, INPUT);
pinMode (IR, INPUT);
}

void loop()
{
digitalWrite(DIRD, HIGH);
digitalWrite(PULD, HIGH);
delayMicroseconds(648); //Speed
digitalWrite(PULD, LOW);
delayMicroseconds(50); //Stop
{
sp = digitalRead(IR);
if (sp == LOW)
{
for (int i = 0; i < 50; i++)
{
digitalWrite(DIRD, LOW);
digitalWrite(PULD, LOW);
delayMicroseconds(10000);
digitalWrite(PULD, LOW);
delayMicroseconds(50);
}
{
val = digitalRead(ORG);
if (val == LOW)
{
for (int x = 0; x < 32000; x++)
{
digitalWrite(DIRT, HIGH);
digitalWrite(PULT, HIGH);
delayMicroseconds(50); //Speed
digitalWrite(PULT, LOW);
delayMicroseconds(100); //Stop
}
{
for (int x = 0; x < 1500; x++)

{
digitalWrite(VLV1, HIGH);
delayMicroseconds(1000);
digitalWrite(VLV1, LOW);
}
}
{
for (int x = 0; x < 32000; x++)
{
digitalWrite(DIRT, HIGH);
digitalWrite(PULT, HIGH);
delayMicroseconds(50); //Speed
digitalWrite(PULT, LOW);
delayMicroseconds(100); //Stop
}
}
{
for (int x = 0; x < 1500; x++)

{
digitalWrite(VLV1, HIGH);
delayMicroseconds(1000);
digitalWrite(VLV1, LOW);
}
for (int i = 0; i < 2500; i++)
{
digitalWrite(DIRD, HIGH);
digitalWrite(PULD, HIGH);
delayMicroseconds(648); //Speed
digitalWrite(PULD, LOW);
delayMicroseconds(50); //Stop
}
}
} else {
digitalWrite(DIRT, LOW);
}
}
}

}

}

Please tell us in detail what your program actually does and what you want it to do that is different.

To make it easy for people to help you please modify your post and use the code button </>
codeButton.png

so your code 
looks like this

and is easy to copy to a text editor. See How to use the Forum

...R