I want to make a DC motor turn on while an LED is on but make it turn off when a Second LED is on with the click of a button

what was so useful? what do you expect the code to do

when i strip out the lcd operations and questionable while loops i get

void loop ()
{
    count = 0;  // set count to zero
    digitalWrite (motor1,LOW);

    if (millis()-timestamp > 1000)  {
        state++;
        timestamp = millis ();
    }

    // alternate timing between study and breaks
    while (count < repeats)  {
        digitalWrite (led1, HIGH);
        digitalWrite (led2, LOW);

        digitalWrite (led1,LOW);
        digitalWrite (led2,HIGH);
    }
}

this code toggle the motor and LED pins on/off with each button press

const byte led1 = 6;
const byte led2 = 7;
const byte button = 8;
const byte motor1 = 9;

byte butState;

enum { LedOn   = LOW,  LedOff   = HIGH };   // active LOW
enum { MotorOn = HIGH, MotorOff = LOW };    // turn on MOSFET
enum { Off, On };
int state = Off;

char s [90];

// -----------------------------------------------------------------------------
void motorOff (void)
{
    digitalWrite (motor1, MotorOff);
    digitalWrite (led1,   LedOff);
    digitalWrite (led2,   LedOn);
    state = Off;
}

// -------------------------------------
void motorOn  (void)
{
    digitalWrite (motor1, MotorOn);
    digitalWrite (led1,   LedOn);
    digitalWrite (led2,   LedOff);
    state = On;
}

// -----------------------------------------------------------------------------
void loop ()
{
    byte but = digitalRead (button);
    if (butState != but)  {
        butState = but;
        delay (20);         // debounce

        if (LOW == but)  {
            if (Off == state)
                motorOn ();
            else
                motorOff ();
        }
    }
}

// -----------------------------------------------------------------------------
void setup () // setup code that only runs once
{
    pinMode (led1,   OUTPUT);
    pinMode (led2,   OUTPUT);
    pinMode (motor1, OUTPUT);

    pinMode (button, INPUT_PULLUP);
    butState = digitalRead (button);

    motorOff ();
}