Here is code.. Before executing this code make sure raster library is installed in R
library(raster)
#setting working directory(folder path containing all rasters)
setwd("G:\\new_gl_data\\4har")
#listing all raster in a folder
rlist=list.files(getwd(), pattern=".tif$", full.names=F)
#change year here (2001:2015)
for (yr in 2001:2015){
nlist = rlist[grep(yr,rlist)]
stack_ras = stack(nlist)
sum_ras = sum(stack_ras)
sum_brk = brick(sum_ras)
writeRaster(sum_brk, filename=paste("prc_",yr,sep=""), format="HFA",overwrite=TRUE)
rm()
gc()
}