South Berwick Maine is interesting because there were three lines that went through the town. There was the Boston and Maine which is still running, the Portsmouth, Great Falls, and Conway as well as the Portland, Sacot, and Portsmouth. The latter two lines have been abandoned and a stretch of track between the current alignment and South Berwick Jct has been abandoned as well.
Let's start with the Boston and Maine.
This recent topo shows the Boston and Maine Railroad coming across
the river from Rollingsford. Right after the tracks go past route 236,
you will a spur going off the the right. The line going straight and then
curving a bit to the north is the current B&M alignment.
The old railroad grade here is the original B&M alignment when
it was first built. It joined with the Portland Saco and Portsmouth in
S. Berwick.
Here is where the Boston and Maine interchanged with the P.S.&P.
The old railroad grade is the original B&M and the right of way adjacent
to the power lines is the old P.S.&P. Agamenticus Station was formerly
South Berwick Junction.
This aerial photo shows, just barely, the original alignment of the
B&M. You need to study the above topos then look for the right of way
on these aerial photos.
This aerial photo shows the original B&M right of way coming in
and joining the P.S.&P.