I want different colors for different cubes, but all the meshes keep following the same color

Here is the main kinda logic/code

move const boxMaterial inside createBox(position, color)

Why do I even code