Why T-test used in linear regression doesn't consider sample size In case of hypothesis test we usually use z-test for larger sample size and t-test for smaller sample. but in linear regression analysis why do we always use t-test for individual coefficient even if the sample size is larger?
 A: The t-test is the right way to do it if we do not know the variance (which we pretty much never know in practice). Thus, the answer to your question is because the t-test is the correct method.
So why use the z-test as your have described? It is a fine approximation of the t-test for large sample sizes. There is a sense in which the t-distribution converges to standard normal as the degrees of freedom increases, and this approximation exploits that fact by saying that, for a large sample size (thus large degrees of freedom), the standard normal distribution used in the z-test is close enough.
You can plot this in R.
library(ggplot2)
x <- seq(-4, 4, 0.001) 
d <- data.frame(x=x, y=dnorm(x, 0, 1), Distribution="N(0, 1)")
d1 <- data.frame(x=x, y=dt(x, 1), Distribution="t_1")
d10 <- data.frame(x=x, y=dt(x, 10), Distribution="t_10")
d100 <- data.frame(x=x, y=dt(x, 100), Distribution="t_100")
d1000 <- data.frame(x=x, y=dt(x, 1000), Distribution="t_1000")
my_df <- rbind(d, d1, d10, d100, d1000)
ggplot(my_df, aes(x=x, y=y, col=Distribution)) + geom_line() + theme_bw()


Notice the fit getting tighter and tighter to the standard normal as the $t$-distribution degrees of freedom increase. For $1000$ degrees of freedom, I cannot even spot a difference. I would encourage you to play with other sample sizes, too, and check out how they look.
