Please use code tags when posting code.
First you need a basic understanding of Unity and C#.
Unity learn and youtube have a lot of tutorials.
For interactions in VR, I’d suggest using the XR Interaction Toolkit.
They even have an example project that you can look into.