# Forecasting for future periods with machine learning models - how to treat input variables

I have a dataset of X1,X2,X3,etc. to predict the number of units, and one or some of my X variables are lagged versions of the units (my Y variable) I am trying to predict in addition to other explanatory variables. I am planning on using ARIMAX, linear regression, XG Boost, and Random Forest.

Let's say I have the following data set

Week Y   X1 X2 X3
1    90  90 67 67
2    98  89 88 34
3    56  89 67 67
4    78  90 68 67


In order to forecast week 5 and so on, how does this work with the models I plan to use? To use linear regression as an example, the model will be trained/tested on my current data set up to week four and generate the coefficients against the X inputs. In order to predict week 5-20, do I need to forecast out separately the trends of X1, X2, X3 as univariate time series?

Essentially, I am trying to understand what happens mathematically for the X1, X2, X3 for weeks 5-20 such that the model is able to generate the Y for these weeks.