Create a ‘stroke only’ shape layer with four points using the pen tool – with RotoBezier mode on (or rmb on the path attribute and convert to rotobezier).
Window menu > Create Nulls from paths.jsx
Select the path in the shape layer – note: the path itself, not the path group.
Click the ‘Points follow Nulls’ button in the above dialog.
This will give you four nulls you can now animate. The path points will follow those nulls.
The Rotobezier mode will give you a more natural ‘automatic’ curvature to the path.
You can then use expressions on each null to move the curve points around.
https://community.adobe.com/t5/after-effects/connect-dots-in-a-curved-way/td-p/10115221?page=1