Is there any command to take create back up of a file as soon as when it is created?If not is it possible to create something like that?
Not a command, no. What guarantee would you have that you caught it at the right instant? You need something more fundamental.
Linux can do so at the filesystem level with NILFS, a snapshotting filesystem which keeps past versions of files in case you need them. Each snapshot is independently accessible.
It'd be a big space waster for files that change often of course! A huge file that completely changes all the time would take a lot of space to snapshot.
So you are ssaying every ile is having a back up right?
I'm saying it takes snapshots of what your folders looked like at certain times. So if you deleted all your files 5 minutes ago, and there's a snapshot from 10 minutes ago, you can look in that snapshot to find all your files.
For details I suggest reading the page I linked.