You are asking about this trip on a forum, so I have to say NO, DON'T GO ALONE THE FIRST TIME.
Its a full (or 3/4) day, one-way hike. You go to Khanpur dam on foot and return on wheeled transport. You have to cross Margalla hills and there is no regular track or marked path. First-timers join a hiking club/group and learn the trek with experienced trekkers and hikers. There are several starting points in Islamabad, two or maybe three points that trekkers use to cross Margalla hills and a few treks to Khanpur dam.