How to parent a mask to another element in AfterFX?
At the moment parenting a mask or its vertices to another object like a null is not possible by default. Although it is one of the most wanted features, probably there is no official solution for this. But in the same link you can find a link to a forum post where scripting master Dan Ebberts offers a solution. This solution has some limitations though, yet it might work in your project.

My solution would be more manual, this is not the fastest way but it works. If you are using a text layer, try adding an animator for the opacity, based on the characters.



Then animate your cursor layer's position accordingly. Or better, parent it to a null and animate your null and use hold keyframes.

This option is better than animating a mask on text layers, as it reveals each character. In your screenshot, there is this situation that your letters are revealed as if a linear wipe is used.