The two main products of photosynthesis are sugar and oxygen. Oxygen is emitted as waste product and sugar is used for energy preparation using sun light.
The soil is formed by breaking down of large rock surfaces into pieces due to water, wind and all atmospheric changes by mixing with plants and animal decays. This process is called as weathering.