It would serve you well to look at how some of us build our rockets, and get a feel for how they go together. Search the forums for "build threads" and concentrate on the more simple construction techniques for inspiration. Simple = more likely to succeed.
The motor length is not critical, as long as you have enough room in the airframe for the motor. Your motor mount tube doesn't need to be the full length of the motor. The motor's aft retainer will be the thrust ring that prevents the motor from moving forward under thrust, and something like the retainer Art linked above or the simple clips below will prevent the motor from being pushed rearward when the airframe is pressurized to eject the recovery system..
View attachment 630233
It's not a challenge to make a rocket with 4 kg payload go 5000 feet using an L-class motor. There are many ready-made kits out there that can do the job. Researching what's available and how they are assembled can save you time, and you can use that time for building and testing.