Get production count for current minute
As I said in a comment, if you really need to compute that moving sum,
you absolutely need to store the last 60 one-second counts in memory.
That being said, there are a few small issues with this code for which I
would have some suggestions:

There is no point in storing totalCount. You do not really use it,
and it will eventually overflow.

You do not need to explicitly initialize all globals to zero, as that
is implicitly done by the runtime: it is a requirement of the
language.

Your are calling digitalRead(countSensor) three times in a row. The
logic for counting edges is sound as long as the three calls yield the
same result, but that is not guaranteed. It is safer to only read the
pin once per loop iteration.

Similarly, the two calls to millis() can yield different results,
and that will make your timings slightly off.

The condition millis() - preMills &gt; 1000 will only fire when
1001 milliseconds have elapsed. Because of the way millis() works,
sometimes you will miss the 1001th millisecond, and process on the
1002nd millisecond. In order to avoid accumulating these small timing
errors, it is best to update preMills by always adding exactly 1000.

As pointed out by jsotola, you do not need to shift the array: you can
instead reuse the array cell that holds the data you do not need
anymore.

You do not need to perform the whole sum every time. You can instead
update the previously computed sum by removing the count of the second
that falls off the current one-minute window, and adding the count of
the current second.


Here is my attempt at applying all the above suggestions. Warning: it
has not been tested.
const uint8_t countSensor = 8;

uint8_t record[60];       // last 60 one-second counts
uint8_t currentIndex;     // current index in record[]
uint8_t oldSensorState;   // previous state of countSensor input
uint32_t previousSecond;  // last time we printed minuteCount
uint8_t thisSecondCount;  // count of items in the current second
uint16_t minuteCount;     // count of items in the last minute

void setup() {
    Serial.begin(9600);
    pinMode(countSensor, INPUT_PULLUP);
}

void loop() {
    // Count falling edges.
    uint8_t sensorState = digitalRead(countSensor);
    if (oldSensorState == HIGH &amp;&amp; sensorState == LOW) {
        thisSecondCount++;
    }
    oldSensorState = sensorState;

    // Update stats every full second.
    if (millis() - previousSecond &gt;= 1000) {
        previousSecond += 1000;

        // Update minuteCount by removing the second that falls off
        // the window and adding the one that enters the window.
        minuteCount += thisSecondCount - record[currentIndex];

        // Replace the count that is not needed anymore by
        // the current one.
        record[currentIndex] = thisSecondCount;

        // Start counting a new second.
        thisSecondCount = 0;

        // Update current index, wrapping at 60.
        if (++currentIndex &gt;= 60) {
            currentIndex = 0;
        }

        Serial.println(minuteCount);
    }
}