Why did God create Lucifer Morningstar? (Satan)

If we had free will there would be no punishment for our actions. The fact that God is said to have punished Adam and Eve for disobeying, shows they didn’t have free will,but had to do as God wanted.So the free will is just to do as God commands?