Probably the simplest answer was that Shakespeare wrote the play to make money. Shakespeare was a playwright writing for a company of actors. The audience consumption for plays was enormous and theatres competed for business. New plays were always welcome and whereas a good bloody tragedy was always good box office, so were comedies. In this case, Shakespeare is drawing from pastoral comedies.
Shakespeare is really a scholar, he writes to explicit his wisdom. So it is his comedy and through it he points out that good nature always remains good and bad always bad. In this comedy Shakespeare describes about Duke who is dethroned by his wicked brother and at last he is banished. He, with his companions, stays at Arden jungle. Whenever he is found in trouble, his friend Amiens and Jacques sing a song to appease him and such things please him a lot. Now the main purpose of writing is to distinguish between materialism and nature, sincerity and treason and real friend and traitor. When we go through the song’ Under the green wood tree', It comes that the frank, sincere and pious person can stay there who always loves peace, love and equality. Because it is full of the merry notes of birds and land is green that is symbolizing for prosperity that is a head of you. In jungle there is no hatred and all work there for survival. Whatever they get, it is honest earning. As far as city life is concerned, it is full of materialism, hatred and deception. There all relationships are violated but money is embraced as the best friend. Again see the other song’ The seven ages of man' uttered by Jacques tells the seven ages of man-infant, unwilling school boy, lover, soldier, justice, the old and the childish. He divulges out psycho very honestly and humorously. He showers wisdom as well as humour.