It was written in terms that the people of that day could understand. The scriptures seem to say that the sun rises and sets they say nothing about the earth going around the sun. Another example of the scriptures being put in terms that the people of the day could understand is the passage when Joshua was leading the Israelites in battle and the sun stood still. Of course not, the earth stopped rotating, an action I believe easily done by an omnipotent God. Because it wouldn't have made sense to the people of that time.
Science is limited.
But it can tell us much about the physical universe. It will never put God on a scale or measure Him with a meter stick. Evolution is a valid scientific theory and should be taught as such. Maybe one day a better theory will come along to replace it. That day is not today.