at that young stage of life you can actually bury some of that main stem under more soil and it will grow more roots
However as the others have said its the light intensity or lack of it that is causing the legginess in the first place
Lower your light or bring the seedling closer to it by propping the pot up on something
Good luck mate