"The Good Work" by Theodore L. Thomas; first published in If, February 1959, whose full text is available at the Internet Archive.
See our previous story-identification question Utopia where no one has to work, but people want to work anyway, which is where I've got all of this answer.
every morning a huge number of workers is brought into this factory to do some kind of useless work ... in my memory they screw in lightbulbs
"Yes, Mr. Winthrop. We have a job for you, and the full six hours a day, too. You will be on the maintenance crew of your building. Your job is explained here—" he passed over a card—"and it consists of tightening the nuts on the expansion joints in the framework of the building. It is very important to do it right, so read the card carefully." Winthrop nodded eagerly.
and then the night shift comes and just undoes all the work from the previous shift, so that the morning shift can do it all over
Winthrop walked in and the two men stood looking at each other. Winthrop was surprised at how well Barlow looked, and he said so.
Barlow laughed. "Yes, the last time we met I was pretty far down in the dumps. But I'm working, Jeremiah. I'm actually working. Important work, too!"
His enthusiasm was infectious and Winthrop found himself laughing. "I'm glad for you, John. And I know how you feel, because I'm working too."
There was an exchange of goodbyes, and Winthrop left.
Barlow went into the other room and came out immediately with his wrench. He waved it playfully at his wife. "Got to go," he said. "The loosening crew won't wait." And he blew a kiss at his wife and went off to work.