This solution is independent of whether the lengths of the lists in the list p
are different.
library(gridExtra)
pdf("plots.pdf", onefile = TRUE)
for (i in seq(length(p))) {
do.call("grid.arrange", p[[i]])
}
dev.off()
Because of onefile = TRUE
the function pdf
saves all graphics appearing sequentially in the same file (one page for one graphic).