fragment() function runs for every single pixel of the screen. Also,
amk is a local variable, it won't be remembered between two calls anyways.
In shaders there is also no way to assign a member variable, that's not how shaders work. The reason is they run on your graphics card, and executed multiple times in parallel. There is no room for shared state.
UV + amk is not what you want.
UV is a
amk is a single number. Which means it will probably add the same number to both X and Y, and your texture will scroll in diagonal, not left and right.
What you need to use is either use a
uniform parameter which you set from script every frame, or the
TIME parameter (which is also a
uniform behind the scenes).
COLOR = texture(TEXTURE, UV + vec2(TIME, 0));
Also make sure your texture has the
Repeat flag checked, otherwise the texture won't repeat.
I stronly recommend you read all of this https://docs.godotengine.org/en/stable/tutorials/shading/index.html