Why does God create ?Allah is the creator and everything besides Him is His creation, which He created from nothing.
The creation is the natural consequence of the attribute of creator.
You wouldn't call a painter, "painter", if he doesn't paint.
Does God need our worship ?No
إِن تَكْفُرُوا۟ فَإِنَّ ٱللَّهَ غَنِىٌّ عَنكُمْ ۖ وَلَا يَرْضَىٰ لِعِبَادِهِ ٱلْكُفْرَ ۖ وَإِن تَشْكُرُوا۟ يَرْضَهُ لَكُمْ ۗ
"
If you disbelieve - indeed, Allah is Free from need of you. And He does not approve for His servants disbelief. And if you are grateful, He approves it for you"
All this takes place according to God’s design who knows all. He does not need any of His servants. They are essentially weak and powerless, but He bestows on them an abundance of His grace. “If you disbelieve, God has no need of you.” If you believe, you will not increase His kingdom in any way. If you disbelieve, this too will not affect His kingdom in any adverse way. He, however, does not like people to disbelieve. By contrast, “lf you give thanks, He is pleased with you.” He will accept this from you and reward you generously for it. Everyone is accountable for their own deeds, and none will be held responsible for another, nor will he be allowed to take upon himself part of another’s burden.
So relative to Allah, we were created in a means or a way in which Allah has chosen to manifest his attributes of creation, mercy, grace etc and he could have chosen another one. But
relative to us as human beings, we know that our purpose is to worship Allah.
Does Allah punish those who doesn't deserve punishment ?No
إِنَّ ٱللَّهَ لَا يَظْلِمُ مِثْقَالَ ذَرَّةٍ ۖ وَإِن تَكُ حَسَنَةً يُضَٰعِفْهَا وَيُؤْتِ مِن لَّدُنْهُ أَجْرًا عَظِيمًا
Indeed, Allah does not do injustice, [even] as much as an atom's weight; while if there is a good deed, He multiplies it and gives from Himself a great reward.Why do we need to worship God ? Worship your Lord, Who created you and those who came before you, that ye may guard (against evil).There is an outcome of worship:
Attaining the degree of guarding (taqwa). Man attains the degree of taqwa, that is, he attains the degree of fearing of Allah, abstaining from his prohibitions, keeping away from what He has forbidden. It means, the benefits of worship pertain to man.
People, who do not attain this degree, spend their lives in sins, disobedience, polytheism and ingratitude. They lead men to go to Hell.
http://sunnahonline.com/library/the-call-of-islam/147-why-were-we-created