Instead of i = df you must name the list elements. For your loop this would mean:
file_output = "C:/test/test.xlsx"
for(i in 1:2){
  df <- iris[i,]
  out <- list(df)
  names(out) <- i
  write_xlsx(out, file_output)
}
However, this will result in one file per data.frame, since write_xlsx does not append to existing files (at least to my knowledge). If you want to have only one file with sheets for the various data.frames, you'd have to adapt your code:
file_output = "C:/test/test.xlsx"
vars <- 1:2
out <- vector(mode = "list", length = length(vars))
for(i in vars){ # if you use variable names in vars, use seq_along(vars) instead of vars
  out[[i]] <- iris[i,]
}
names(out) <- vars
write_xlsx(out, file_output)
Since I do not see any merit in using a loop here, I'd even suggest to use map from the purrr package or lapply:
file_output = "C:/test/test.xlsx"
vars <- 1:2
out <- map(vars, ~ iris[.x,])
names(out) <- vars
write_xlsx(out, file_output)