Problem getting this simple For loop correctly

There are several problems with your code, the more evident one is that your idg vector is intended to have length = 2 (although is actually empty) but you are trying to assign positions 6 and 7 and that makes no sense, also it seems like the output of FindMarkers() is not a single element that you can replace in a vector (I can't be sure since you are not providing a proper REPRoducible EXample (reprex))

I can't test if this is going to work, because of the lack of a reprex, but maybe it would point you in the right direction

for (i in 6:7){
    marker_i <- FindMarkers(AllCells.combined,
                ident.1 = "VEH",
                ident.2 = "IMQ",
                verbose = TRUE,
                group.by="stim",
                subset.ident = i)
    assign(paste0("inmunes.", i), marker_i)
}