I have to verify through simulation that the minimum squared estimator of the regression rect is a correct estimator. Also, I need to confront the theoric variance with the one I got through simulation. Finally, I need to provide an estimate of the variance of the residues.
In order for us to be able to help you, you need to provide some more information and create a reprex where you give us the code you've written together with some dummy data to run it:
Judging by the question, it seems that this might be part of a homework or course assignment. If this is the case, please state this clearly in the question (you can update your post anytime) and beware this forum has policies regarding this.