In the first code you posted, when you are processing a single file, you have the lines
Y[,1]<-as.numeric(Y[,1])
Y[,2]<-as.numeric(Y[,2])
f95_gwas(Y)
I do not see similar lines processing the first two columns with as.numeric() when you are using the loop. That may be the cause of the error.
It is certainly possible to combine your two loops so that you use read_csv() to assign the content of a file to Y and then process Y with f95_gwas() (including using as.numeric() to change the first two columns).
I notice that you do not assign the result of f95_gwas() to anything. That might be alright, depending on what the function does, but I mention it because it is a common error to forget to assign the function's returned value.