I have an pi connected to a machine, i can access the machine from a PC which is connected to the LAN, if i use my static IP i can access the machine from anywhere, but the problem is, An LAN with static IP will not be available everywhere, so is there any way to connect that raspberry pi even if i use a network like mobile hotspot without static IP?
Raspberry pi team suggests using weaved for accessing your pi remotely.
Check this link
You need install waved client in your machine and use weaved account to connect to your pi.
You can use a service like noip.com.
Sign up for an account, install the program on your raspberry pi so that it can track the ip address as it changes. Then when you log in with ssh, use the noip supplied address instead of your ip address.
You may need to forward port 22 to your Raspberry Pi's local ip address on your router too.
Try port forwarding or dmz. You will need a router for this.