Any written literary work is based on what the author or writer wishes to convey to the readers. More often than not, there is always a motive behind what an author writes. It is also most times understood that any work is done to show or suggest a moral or subjective issue through the work.
An author may write about anything that he/ she wishes to write upon or delve into. And there may, most likely, be a reason for why he/ she chooses to write it. So, the main purpose of an author is the primary reason he/ she wrote the text.