Your question is really about the basics of writing a loop, and not directly related to raster data. It is important to set up a loop step by step so that you can see what is and what is not working.
First, month should be characters if you want to keep the leading zeros (and use a vector rather then a list)
month <- c("01","02","03","04","05","06","07","08","09","10","11","12")
or like this
month <- formatC(1:12, width=2, flag="0")
month
#[1] "01" "02" "03" "04" "05" "06" "07" "08" "09" "10" "11" "12"
Also, do not put things in the loop that are constant such as tile and name_im.
tile <- "T39LTF"
name_im <- "AMBARO_T39LTF"
months <- formatC(1:12, width=2, flag="0")
You cannot do for i in month because in your example you want i to be a numeric iterator (you use it to index a list). So instead
for (i in 1:length(months)) {
# months is the vector, m is a single month
m <- months[i]
# first create the filenames and check if they are correct
# I am using base-R but you can use the glue package instead
filename <- paste0("D:/Tuiles_José/2021/", m, "/", name_im, "/images/SENTINEL2X_2021", m, "01-000000-000_L3A_", tile, "_C_V2-2/SENTINEL2X_2021", m, "01-000000-000_L3A_", tile, "_C_V2-2_FRC_B4.tif")
print(filename)
## when the above works, add more, step by step
## after trying this for a single file
#r <- raster(filename)
#crs(r) = "+init=epsg:32739"
}
#[1] "D:/Tuiles_José/2021/01/AMBARO_T39LTF/images/SENTINEL2X_20210101-000000-000_L3A_T39LTF_C_V2-2/SENTINEL2X_20210101-000000-000_L3A_T39LTF_C_V2-2_FRC_B4.tif"
#[1] "D:/Tuiles_José/2021/02/AMBARO_T39LTF/images/SENTINEL2X_20210201-000000-000_L3A_T39LTF_C_V2-2/SENTINEL2X_20210201-000000-000_L3A_T39LTF_C_V2-2_FRC_B4.tif"
#[1] "D:/Tuiles_José/2021/03/AMBARO_T39LTF/images/SENTINEL2X_20210301-000000-000_L3A_T39LTF_C_V2-2/SENTINEL2X_20210301-000000-000_L3A_T39LTF_C_V2-2_FRC_B4.tif"
#[1] "D:/Tuiles_José/2021/04/AMBARO_T39LTF/images/SENTINEL2X_20210401-000000-000_L3A_T39LTF_C_V2-2/SENTINEL2X_20210401-000000-000_L3A_T39LTF_C_V2-2_FRC_B4.tif"
#[1] "D:/Tuiles_José/2021/05/AMBARO_T39LTF/images/SENTINEL2X_20210501-000000-000_L3A_T39LTF_C_V2-2/SENTINEL2X_20210501-000000-000_L3A_T39LTF_C_V2-2_FRC_B4.tif"
#[1] "D:/Tuiles_José/2021/06/AMBARO_T39LTF/images/SENTINEL2X_20210601-000000-000_L3A_T39LTF_C_V2-2/SENTINEL2X_20210601-000000-000_L3A_T39LTF_C_V2-2_FRC_B4.tif"
#[1] "D:/Tuiles_José/2021/07/AMBARO_T39LTF/images/SENTINEL2X_20210701-000000-000_L3A_T39LTF_C_V2-2/SENTINEL2X_20210701-000000-000_L3A_T39LTF_C_V2-2_FRC_B4.tif"
#[1] "D:/Tuiles_José/2021/08/AMBARO_T39LTF/images/SENTINEL2X_20210801-000000-000_L3A_T39LTF_C_V2-2/SENTINEL2X_20210801-000000-000_L3A_T39LTF_C_V2-2_FRC_B4.tif"
#[1] "D:/Tuiles_José/2021/09/AMBARO_T39LTF/images/SENTINEL2X_20210901-000000-000_L3A_T39LTF_C_V2-2/SENTINEL2X_20210901-000000-000_L3A_T39LTF_C_V2-2_FRC_B4.tif"
#[1] "D:/Tuiles_José/2021/10/AMBARO_T39LTF/images/SENTINEL2X_20211001-000000-000_L3A_T39LTF_C_V2-2/SENTINEL2X_20211001-000000-000_L3A_T39LTF_C_V2-2_FRC_B4.tif"
#[1] "D:/Tuiles_José/2021/11/AMBARO_T39LTF/images/SENTINEL2X_20211101-000000-000_L3A_T39LTF_C_V2-2/SENTINEL2X_20211101-000000-000_L3A_T39LTF_C_V2-2_FRC_B4.tif"
#[1] "D:/Tuiles_José/2021/12/AMBARO_T39LTF/images/SENTINEL2X_20211201-000000-000_L3A_T39LTF_C_V2-2/SENTINEL2X_20211201-000000-000_L3A_T39LTF_C_V2-2_FRC_B4.tif"
But not that because R is "vectorized", you can also get these file names like this, without a loop
tile <- "T39LTF"
name_im <- "AMBARO_T39LTF"
months <- formatC(1:12, width=2, flag="0")
filenames <- paste0("D:/Tuiles_José/2021/", months, "/", name_im, "/images/SENTINEL2X_2021", months, "01-000000-000_L3A_", tile, "_C_V2-2/SENTINEL2X_2021", months, "01-000000-000_L3A_", tile, "_C_V2-2_FRC_B4.tif")
And then perhaps do
s <- stack(filenames)