Answer :
Magma, like many other things, liquifies at high heat and it cools down and solidifies at low temperatures. Basically, while inside a volcano, magma is liquid and extremely hot and flows freely. When it bursts out, it becomes lava and starts cooling down due to the air and winds and things like that, so it starts turning into rocks and in time these rocks create new layers of the volcano. This is how many islands were formed.
As temperature increases the viscosity of magma decreases,so the magma flows more easily.