There are essays which make a statement and then ask us for our opinion.

for example in an IELTS exam it says " Education is important- agree or disagree?" are we suppose

d to tell both viewpoints and support one in the end or we should either agree or disagree with statement from the beginning and support it throughout the essay?
When you get an essay topic, pay very close attention to the question. If it asks for a discussion of both sides of an argument, then give both. If it asks for your opinion, then decide which side you are on and argue in its favor. The important point is to understand the question, and make a good essay that answers the question.