Need help with shortening repeating code

I need help in finishing a project where im using my arduino uno to go through a series of commands to operate a remote. The issue im having is to shortening my code as alot of the buttons will be "pressed" repeatedly. Im not sure how to reference it so I can use a much smaller phrase

  // Down Button Press
  digitalWrite(Dpin, HIGH);   // Press Button 
  delay(250);                  // waits for .25 sec
  digitalWrite(Dpin, LOW);   // releases button 
  
  // Up Button Press
  digitalWrite(Upin, HIGH);   // Press Button 
  delay(250);                  // waits for .25 sec
  digitalWrite(Upin, LOW);   // releases button 
  
  // Left Button Press         
  digitalWrite(Lpin, HIGH);        //Press Button
  delay(250);                  // Wait for .25 sec
  digitalWrite(Lpin, LOW);     // Releases Button
  
  // Right Button Press 
  digitalWrite(Rpin, HIGH);   // Press Button 
  delay(250);                  // waits for .25 sec
  digitalWrite(Rpin, LOW);   // releases button 
  
  //Back Button Press
  digitalWrite(BKpin, HIGH);   // Press Button 
  delay(250);                  // waits for .25 sec
  digitalWrite(BKpin, LOW);   // releases button 
  
  //Select/Ok Button Press
  digitalWrite(BKpin, HIGH);   // Press Button 
  delay(250);                  // waits for .25 sec
  digitalWrite(BKpin, LOW);   // releases button 
  
  //Home Button Press
  digitalWrite(Hpin, HIGH);   // Press Button 
  delay(250);                  // waits for .25 sec
  digitalWrite(Hpin, LOW);   // releases button

Look up arrays and for loops.

something this simple you can call as a function

const byte Dpin = 2;
const byte Upin = 3;
const byte Lpin = 4;
const byte Rpin = 5;
const byte BKpin = 6;
const byte Hpin = 7;

void setup() {
  // put your setup code here, to run once:
pinMode(Dpin,OUTPUT);
pinMode(Upin,OUTPUT);
pinMode(Lpin,OUTPUT);
pinMode(Rpin,OUTPUT);
pinMode(BKpin,OUTPUT);
pinMode(Hpin,OUTPUT);
}

void loop() {
  // put your main code here, to run repeatedly:

pressAndRelease(Dpin);
pressAndRelease(Upin);
pressAndRelease(Lpin);
pressAndRelease(Rpin);
pressAndRelease(BKpin);
pressAndRelease(Hpin);

}

void pressAndRelease(int thisPin){
   digitalWrite(thisPin, HIGH);   // Press Button 
  delay(250);                  // waits for .25 sec
  digitalWrite(thisPin, LOW);   // releases button 
}

@Modme09, you may find some useful concepts in Planning and Implementing a Program

...R

If some day you want to run various sequences of button presses you can use arrays and pointers to allow the sequences to be defined by data rather than by code:

const byte Dpin = 2;
const byte Upin = 3;
const byte Lpin = 4;
const byte Rpin = 5;
const byte BKpin = 6;
const byte Hpin = 7;

const byte PinList[] = {Dpin, Upin, Lpin, Rpin, BKpin, Hpin};  // List all output pins for setup()

const byte Sequence[] = {Dpin, Upin, Lpin, Rpin, BKpin, Hpin};  // A sequence to press in order

void setup() {
  for (int i = 0; i < sizeof PinList; i++)
    pinMode(PinList[i], OUTPUT);
}

void loop() {
  RunSequence(Sequence, sizeof Sequence);
}

void RunSequence(const byte *seq, size_t count) {
  for (int i = 0; i < count; i++)
    pressAndRelease(seq[i]);
}

void pressAndRelease(int thisPin) {
  digitalWrite(thisPin, HIGH);   // Press Button
  delay(250);                  // waits for .25 sec
  digitalWrite(thisPin, LOW);   // releases button
}

Thank you all for your help I will be rewriting my code soon with functions as mentioned above. As of now I have taken the time to write all 1970 lines of my original redundant code but on the bright side it did work wonderfully, but with functions itll be reduced by 2/3.