What can be the factors that influenced an author in writing?
Many different factors affect writers and influence their writing. The first factor is economic. According to his biographer, Boswell, Samuel Johnson claimed "No man but a blockhead ever wrote, except for money." Because authorship is a profession, authors are influenced by how they are paid. Before the advent of copyright, the normal economy of authorship was patronage, and so authors needed to curry favor with rich patrons. Starting the eighteenth century, the growth of periodicals meant that writers had to appeal not only to the reader, but also to editors selecting works for publication. The mass market for literature that developed in the late nineteenth century meant writing for a broad public.
Different circumstances of publication mean different writing styles, with, for example, the structure of the Victorian novel arising, in part from the need for a "cliffhanger" at the end of each chapter due to serialization in periodicals.
As well as audience, writers are influenced by generic conventions which create a set of reader expectations. Writers are also influenced by their personal ethics and religious beliefs. Many writers are influenced by other authors or the writing training they received in schools. Almost any factor that shapes a person shapes their writing to a degree.