Need some help with coding of a light and a button

so to start, i am new to coding and these arduino (teensy) boards, but i succesfully programmed 1 of my 2 boards to be a keyboard command of "space bar" when a button is pressed and not allow another button press for 2000ms, but i am now trying to program a second teensy board to be the key board commands of "control+p" in order to print something, and turn on a light for a certain amount of time. is there anyone that can look through my code and help me out with this? i tried to take the code from my spacebar button and modify it for this new command, but i do not know if i did it right, or how to incorporate the light in to the circuit as well. attached is a picture of the coding i have copied and modified.

I predict that you will go no help unless you copy your code and paste it here between code tags (# above the editor)

here is the code:

void setup() {
  Serial.begin(9600);
  pinMode(13, INPUT_PULLUP); //what pin to read
  delay(4000); //delay from start up/plug in
}

void loop() {
  if (digitalRead(13) == HIGH) { //what pin to read
    delay(10); //how long to hold button
  } else {
    
    // press and hold CTRL
Keyboard.set_modifier(MODIFIERKEY_CTRL);
Keyboard.send_now();
// press P while still holding CTRL
Keyboard.set_modifier(MODIFIERKEY_CTRL | KEY_P);
Keyboard.send_now();
    // release all the keys at the same instant
Keyboard.set_modifier(0);
Keyboard.set_key1(0);
Keyboard.send_now();
    
    delay(20000); //delay until next button push is allowed in "ms"
  }
  delay(10); //delay in "ms"
}  
// This is new code, hopefully to activiate a light on button push. copied from arduino.cc/tutorial/button
// constants won't change. They're used here to
// set pin numbers:
const int buttonPin = 2;     // the number of the pushbutton pin
const int ledPin =  11;      // the number of the LED pin

// variables will change:
int buttonState = 0;         // variable for reading the pushbutton status

void setup() {
  // initialize the LED pin as an output:
  pinMode(ledPin, OUTPUT);      
  // initialize the pushbutton pin as an input:
  pinMode(buttonPin, INPUT);    
}

void loop(){
  // read the state of the pushbutton value:
  buttonState = digitalRead(buttonPin);

  // check if the pushbutton is pressed.
  // if it is, the buttonState is HIGH:
  if (buttonState == HIGH) {    
    // turn LED on:    
    digitalWrite(ledPin, HIGH);  
  }
  else {
    // turn LED off:
    digitalWrite(ledPin, LOW delay(2000) );
  }
}

Thanks for posting the code but it is normal only to post one program in each set of code tags, but full marks for using the tags. Many don't.

    digitalWrite(ledPin, LOW delay(2000) );

Errr, no. Copy/paste problem, perhaps.

my goal there was to have the light stay on for 20 seconds before turning off again. this clearly is not the way to do it, so is there a way to accomplish this?

digitalWrite takes 2 arguments separated by commas.
Has this code got 2 arguments separated by commas ?

digitalWrite(ledPin, LOW delay(2000) );

You could look at the Blink example to see how it is done using the Delay function - try starting with Blnk as your source, run it to see the effect, then build-on your other bits of code need for your button push.

The Blink example comes with the IDE when you download it, along with lots of other useful stuff to get you started.

so if i add some of the code from the blinking led after my button circuit and use the pins that are tied to the existing onboard led, that should work? ill post my code in a few minutes once i play with it some more.

how does this look?

void setup() {
  Serial.begin(9600);
  pinMode(13, INPUT_PULLUP); //what pin to read
  delay(4000); //delay from start up/plug in
}

void loop() {
  if (digitalRead(13) == HIGH) { //what pin to read
    delay(10); //how long to hold button
  } else {
    
    // press and hold CTRL
Keyboard.set_modifier(MODIFIERKEY_CTRL);
Keyboard.send_now();
// press P while still holding CTRL
Keyboard.set_modifier(MODIFIERKEY_CTRL | KEY_P);
Keyboard.send_now();
    // release all the keys at the same instant
Keyboard.set_modifier(0);
Keyboard.set_key1(0);
Keyboard.send_now();
    
    delay(20000); //delay until next button push is allowed in "ms"
  }
  delay(10); //delay in "ms"
}  
// This is new code, hopefully to activiate a light on button push. Copied from Button Arduino Example

// Pin 11 has the LED on Teensy 2.0


// constants won't change. They're used here to 
// set pin numbers:
const int buttonPin = 13;     // the number of the pushbutton pin
const int ledPin =  11;      // the number of the LED pin
  // Pin 13: Arduino has an LED connected on pin 13
  // Pin 11: Teensy 2.0 has the LED on pin 11


// variables will change:
int buttonState = 0;         // variable for reading the pushbutton status

void setup() {
  // initialize the LED pin as an output:
  pinMode(ledPin, OUTPUT);      
  // initialize the pushbutton pin as an input:
  pinMode(buttonPin, INPUT);     
}

void loop(){
  // read the state of the pushbutton value:
  buttonState = digitalRead(buttonPin);

  // check if the pushbutton is pressed.
  // if it is, the buttonState is HIGH:
  if (buttonState == HIGH) {     
    // turn LED on:    
    digitalWrite(ledPin, HIGH);  
     delay(20000); 
  } 
  else {
    // turn LED off:
    digitalWrite(ledPin, LOW); 
  }
}

thanks to all the help, i got my code to work. not when pin 13 is shorted to ground, a keyboard command of apple+p is clicked, followed by return 10ms later. at the same time, the led on the board lights up for 20 seconds and turns off. the point of this was for a photo booth where after the guests are done with their session, and 1 print is made, a second print can be made by push of a single button. no users have to touch the computer or keyboard.

Tried shortening this

if (buttonState == HIGH) {
// turn LED on:
digitalWrite(ledPin, HIGH);

to this?
digitalWrite(ledPin, buttonstate);