Why does this script loop and glitch?

I am making a game where a knife goes from point A to B and loops that, but when the knife’s speed increases (it increases when scored +1) it glitches to random location on the axis between A and B, when it should just keep moving from same position with higher speed. Ask me more if you need to know and thanks for trying to help me!

void Update () 
{
transform.position = Vector3.Lerp(pos1, pos2, (Mathf.Sin(speed * Time.time) + 1.0f) / 2.0f);
}

@Aappo
You can try this:

 void Update () 
 {
 transform.position = Vector3.MoveTowards(pos1, pos2, (Mathf.Sin(speed * Time.time) + 1.0f) / 2.0f);
 }

If you have any questions or it doesn’t perform how
It is supposed to feel free to comment about it on my answer and I will help :smiley: