Can I change animation key frame property in script?

For example I have a code for an object and a camera:

    public GameObject object1;
    public Camera camera1;
    
    void Start()
    {
    object1.transform.position = new Vector3(Random.Range(-3f, 3f), Random.Range(-3f, 3f), 0);
    camera1.transform.position = new Vector3(0, 0, -10);
    }

And I want for second key frame in animation to set x and y position from object1.

How can I edit this in script?

Check this out: