I have a rectangle whose position at first keyframe-1 is (400,300) then at next keyframe-2 its (400,157) then i create another keyframe-3 with same position (400,157) after 1 sec and the final keyframe-4 at position (400,300) , the problem is position between keyframe-2 and keyframe-3 is changing despite being at same position, how can i solve that?
There are two types of interpolation for keyframes - temporal, and spatial. In plain English, temporal interpolation is how the speed of the motion is interpolated between keyframes - it's what you change when you ctrl or ⌘-click a keyframe, and spatial interpolation is how the motion path is interpolated between keys. Your problem is that AE is applying the wrong spatial interpolation.
Usually After Effects uses Bézier spatial interpolation between keyframes, meaning that they create smooth curves in space, which is usually what you want. However when you create a static pair of keyframes this causes problems - the layer overshoots the first keyframe and bounces back to the second.
To eliminate the problem bring up the keyframe interpolation dialog. You can either right-click the keyframe or use the keyboard shortcut alt⌘k (mac) or altctrlk (pc). Set the spatial interpolation to linear. This has the unfortunate side effect that any bezier handles you may have carefully created on the keyframe disappear. To make only one side of the keyframe have a handle you can select the keyframe in the timeline window, then alt-click it in the composition window (the cursor should turn into the V shaped arrow). In more recent versions of AE this will give you a bezier handle on the incoming and outgoing curves, not on the curve between the two identical keyframes. But because they're on top of each other you need to select them individually in the timeline first.
There's another way that I should mention, and this is by changing the temporal interpolation. If you right-click the first of the identical keyframes and choose toggle hold keyframe the motion will freeze until the next keyframe. If the keyframes weren't identical it would instantly jump to the second keyframe at that point.
Change the spatial interpolation of keyframe-2 to either Linear or Hold.