You can generate such mobility files using tools such as Mobisim and SUMO.
Mobisim and SUMO can be used to generate mobility trace files that will compatible with ns-2.
compared with SUMO, using mobisim is easy and somewhat straightforward. But SUMO can be used to generate more realistic mobility scenarios.
Both are open-source projects with excellent documentation; so you can simply download and use them.
You may learn to use them from the official web pages of mobisim and SUMO.
You may have a quick look at the following post to understand their usage:
