How to assign x and y transform values of an gameobject to user defined variables?

I have created a project consisting of a sphere that needs to stick to the inner surface wall of a tunnel. So i have attached a script to the sphere:

using UnityEngine;
using System.Collections;

public class GravityOnBall : MonoBehaviour
{ public float GravX;
public float GravY;
public float Mult;

void Start () {

Physics.gravity = new Vector3(GravX * Mult, GravY * Mult, 0);
}

}

What I want to do is to assign the x and y coordinate values of the transform position of gameobject which is the sphere to the variables GravX and GravY respectively.

Please help me to write a script for the above mentioned task.

Uhm… Are you sure you phrased your question correctly?

What I want to do is to assign the x and y coordinate values of the transform position of gameobject which is the sphere to the variables GravX and GravY respectively.

GravX = transform.position.x;
GravY = transform.position.y;