Remember that the likelihood function is the a function over the unknown parameters. It is used when we have a fixed set of data and we are looking over the possible values of the parameters (e.g., to fit the model). Once the model is fitted, you now have specific estimates for the parameters so you are generally no longer interested in looking at the likelihood function over the parameters. You can of course substitute your estimated parameters back into the likelihood function; if you estimated using the MLEs then this substitution gives you back the maximised likelihood. Setting that aside, here is how you get the likelihood for a standard linear regression model.
Log-likelihood for a standard linear regression: For a standard linear regression model, with uncorrelated homoscedastic normal error terms, the full model form is:
$$\boldsymbol{Y} = \boldsymbol{x} \boldsymbol{\beta} + \boldsymbol{\varepsilon} \quad \quad \quad \boldsymbol{\varepsilon} \sim \text{N}(\boldsymbol{0}, \sigma^2 \boldsymbol{I}).$$
This model form gives $\boldsymbol{\varepsilon} = \boldsymbol{y} - \boldsymbol{x} \boldsymbol{\beta}$ so that the individual error terms are $\varepsilon_i = y_i - \mathbf{x}_i \cdot \boldsymbol{\beta}$. The error vector represents the deviation of the observed response vector from its expected value under the model. Using this vector gives you the log-likelihood function for the model:
$$\begin{equation} \begin{aligned}
\ell_{\boldsymbol{y},\boldsymbol{x}} (\boldsymbol{\beta}, \sigma)
&= \sum_{i=1}^n \ln \text{N} ( \varepsilon_i | 0, \sigma^2) \\[6pt]
&= \sum_{i=1}^n \ln \text{N} ( y_i - \mathbf{x}_i \cdot \boldsymbol{\beta} | 0, \sigma^2) \\[6pt]
&= \frac{n}{2} \ln(2 \pi) + n \ln(\sigma) - \frac{1}{2 \sigma^2} \sum_{i=1}^n (y_i - \mathbf{x}_i \cdot \boldsymbol{\beta})^2 \\[6pt]
&= \frac{n}{2} \ln(2 \pi) + n \ln(\sigma) - \frac{1}{2 \sigma^2} || \boldsymbol{y} - \boldsymbol{x} \boldsymbol{\beta} ||^2. \\[6pt]
\end{aligned} \end{equation}$$
(The corresponding likelihood function is just the exponential of this.) Maximising this log-likelihood function gives the MLEs $\hat{\boldsymbol{\beta}} = (\boldsymbol{x}^\text{T} \boldsymbol{x})^{-1} (\boldsymbol{x}^\text{T} \boldsymbol{y})$ and $\hat{\sigma}_\text{MLE}^2 = \tfrac{1}{n} || \boldsymbol{y} - \boldsymbol{x} \hat{\boldsymbol{\beta}} ||^2$.$^\dagger$ The coefficient estimator gives the residual vector $\boldsymbol{r} = \boldsymbol{y} - \boldsymbol{x} \hat{\boldsymbol{\beta}} = (\boldsymbol{I} - \boldsymbol{x} (\boldsymbol{x}^\text{T} \boldsymbol{x})^{-1} \boldsymbol{x}^\text{T}) \boldsymbol{y}$. Substitution into the log-likelihood gives the maximised value:
$$\begin{equation} \begin{aligned}
\max_{\boldsymbol{\beta}, \sigma} \ell_{\boldsymbol{y},\boldsymbol{x}} (\boldsymbol{\beta}, \sigma)
= \ell_{\boldsymbol{y},\boldsymbol{x}} (\hat{\boldsymbol{\beta}}, \hat{\sigma}_\text{MLE})
&= \frac{n}{2} \ln(2 \pi) - n \ln n + n \ln ||\boldsymbol{r}|| - \frac{n}{2}. \\[6pt]
&= \frac{n}{2} (\ln(2 \pi)-1) + n \ln \Big( \frac{||\boldsymbol{r}||}{n} \Big). \\[6pt]
\end{aligned} \end{equation}$$
You can program this into R
or Python
if you like, but all of this area of theory has well-known formulae for tests, etc., so you will probably find that you can just look it up in books on regression, rather than using computational optimisers in statistical programming.
$^\dagger$ The MLE for the error variance is biased downward. To correct this bias it is standard practice to use the bias-adjusted estimator $\hat{\sigma}^2 = \tfrac{n}{df_{Res}} \cdot \hat{\sigma}^2 = \tfrac{1}{df_{Res}} || \boldsymbol{y} - \boldsymbol{x} \hat{\boldsymbol{\beta}} ||^2$ where $df_{Res}$ is the residual degrees-of-freedom in the regression. This bias-correction is an extension of Bessel's correction for sample variances.