I've not really used terrains but assuming your heightmap is continuous one solution would be to make the heightmap twice the size of what you need i.e. if the terrain is 256x256 make it 512x512 and duplicate the 256x256 4 times (top-left top-right etc..)
Then when the player gets to within 128 units in the x or z direction of the terrain edge - just move it to the opposite side of the terrain - which will be identical.
Assume center is 256,256.
if x < 128 x=384 - (128 - x)
if x > 384 x=128 + (x - 384)
if z < 128 z=384 - (128 - z)
if z > 384 z=128 + (z - 384)
Not sure if this'll make any sense to you but hopefully you get the idea.
Then when the player gets to within 128 units in the x or z direction of the terrain edge - just move it to the opposite side of the terrain - which will be identical.
Assume center is 256,256.
if x < 128 x=384 - (128 - x)
if x > 384 x=128 + (x - 384)
if z < 128 z=384 - (128 - z)
if z > 384 z=128 + (z - 384)
Not sure if this'll make any sense to you but hopefully you get the idea.