Letters like a, c, y, and the word speed# are called variables, which store different numbers. But if you don't tell them what numbers to be, they will be zero - so start by saying what they are equal to.
Try:
LOAD IMAGE "bkgd.bmp",1
LOAD IMAGE "sprite.bmp",2
LOAD MUSIC "loop.mp3",1
SPRITE 1,1,1,1
SPRITE 2,20,500,2
LOOP MUSIC 1
a=100 `sets the amplitude
c=screen width()/2 `sets the sprite to the centre horizontally
y=screen height()/2 `sets the sprite to the centre vertically
speed#=0.5 `sets the speed of the motion
do
x=a*cos(angle#)+c
inc angle#,speed#
sprite 2,x,y,2
loop
That should produce a cosine movement - although I'm not really sure if that's what you're after!