Hi,
Actually the draw() function is already a loop that renders an image. See https://processing.org/reference/draw_.html
What you can do is update your a variable once at the beginning of the draw function. For example
int a = 1;
int delta = 10;
void setup() {
size(640, 600);
background(51);
}
void draw()
{
//Background fills the canvas
background(51);
fill(255, 212, 0);
//allows to keep a inside the canvas
if (a > height) delta = -10;
else if (a < 0) delta = 10;
a += delta;
//print hello world
text("Hello World", a, a);
}