added xml writer function in R