append output to xlsx or csv

If you create a list from all the output then you can use write_xlsx (writexl package) to write each output to its own sheet.

library(writexl)

my_output_list <- list("domain_ct"  = domain_ct, 
                       "domain_ct2" = domain_ct)

my_outfile <- "output.xlsx"
writexl(my_output_list, my_outfile)