Wrote an R code for executing sem model