Why did god create Satan if he knew exactly what Satan would do?
For the same reason he created Christians with a free will. If he made us only able to serve him then we would be mindless robots. But because of the free will we can choose to love and serve him. However God knows there will be those who will reject this gift. You can’t choose between two things if there’s only one choice. Satan provides the other choice. It would be wrong of God to not let some one live just because he knew they would make a disastrous choice. Again it’s part of free will.