Timing push button code
Your source has several flaws, and one error that generates the output you see. This is the analysis of the error.
In loop() you start by waiting for the button pin to get HIGH, following by another read of the pin's state that will most probably return the same, HIGH. Note: Only if your button bounces with just the right timing, this last read will return LOW.
while (digitalRead(button1Pin) == LOW) {}
button1State = digitalRead(button1Pin);

Next you check the pin's state, and let's assume that it is HIGH. Only the else part is executed, and it calculates the holdtime as the difference of endPressed and startPressed. The former has the current value of millis(), but the latter is 0 as you initialized it.
That's why you're getting always growing values.
How to solve?
Think about the while loops, do you need them? Remember that loop() is already called repeatedly.
You may need a state variable that stores the last pin's state, so you can detect changes.