it could be because you are working with local position.
please use and read about it.
var posGlobal: Vector2 = get_global_transform().get_origin()
it is going to give you the global position of the node.
if this node is part of another node you make sure this one is placed at origin coordinate because this node could be in other position (offset)
but how do you access this (global_position) without using the other ( get_global_transform). If you have a better asnwer I would like to know it, I like to learn a lot. Thanks.