First of all: the code you provided is not working! It’s missing a colon in the first line, a var in the second line and the definition of speed, positionA and positionB. Also your time-variable t does not increase, but is (more or less) constant.

Here is a complete and working script that you can attach to a Sprite-node:

extends Sprite
var positionA = Vector2(200, 500)
var positionB = Vector2(500, 200)
var t = 0.0
var duration = 5.0
func _process(delta):
t += delta / duration
position = positionA.linear_interpolate(positionB, min(t, 1.0))

If you don’t want to move from positionA to positionB in a straight line, you can’t linearly interpolate the position - that should be obvious from the name! However, you can define a third position and draw a quadratic Bezier curve:

extends Sprite
var positionA = Vector2(200, 500)
var positionB = Vector2(500, 200)
var positionC = Vector2(200, 200)
var t = 0.0
var duration = 5.0
func _process(delta):
t += delta / duration
var q0 = positionA.linear_interpolate(positionC, min(t, 1.0))
var q1 = positionC.linear_interpolate(positionB, min(t, 1.0))
position = q0.linear_interpolate(q1, min(t, 1.0))