for(x in unique_seg){
bf <- data.frame(matrix(x,nrow =3,ncol =3))
write.xlsx(bf,\'bf.xlsx\', sheetname =x, append=True) }
But I see only last loop is