Lasso Regression Doubt
The user has divided it's original dataset into two sets: train set and test set. 

The model i.e., lasso regression should be trained using train set. Then, the trained model is used to test the model on the test set. 

In fact, when you train your model you are trying to find the optimal hyperparameters such as C and regularization (in your code, Grid) via cross validation (in your code, cv).

After finding the optimal hyperparameters, you should train your recently constructed model on the whole train set to find the coefficients (weights) of regression. 

Finally, the model is tested on the test set.