Thanks for your question!
After you set each cube’s keyframes, you can then add the game logic bricks to each cube as the Blender Stack Exchange discussion suggests. I incorporated that code at line 142 of the example below.
What is not shown in the Stack Exchange code is the setting of the properties for each logic brick after it’s created. One of the more significant steps is to assign the cube’s animation data action to the actuator’s action.
For the purposes of looping, I handled how I distributed key frames differently here than in the example from the tutorial.
I’m not very familiar with Blender’s Game Engine, so there might be other, preferred ways to accomplish the same idea.
Since this is a tutorial, feel free to use it as a reference in your work; a credit is always appreciated.