It’s been a common problem here that many people have had: “How do I script X to happen on RectTransforms?” The RectTransform inspector is very helpful for laying out, less helpful for making script functionality discoverable.
The trick to learning what property does what: animation. Create a temporary Animator and AnimationClip, and in the editor (using record mode), move the UI element as you would like the script to change things. Now, look at what properties have been animated in the animation timeline. Those are the properties you want to set in your script!