Yes, it is true that an author usually has a definite purpose for writing something.
A writer's purpose is simply what it says on the tin. The purpose of writing - to entertain, inform, persuade etc. - has a direct impact on the language features used by the author.
Every text that's ever been written has a purpose. This means that children are likely to come across this topic regularly in their English lessons - whether they're thinking about a text they are reading or one they are writing themselves.