have a closer look (remember the loop spins really fast - so when you press your button even for a short while, you'll probably do a few tens or hundreds loops() - and would be more if you did not have the 2ms delay)
I was typing as you modified your answer.
you could use the INPUT_PULLUP mode to avoid having the external resistor and it's easier to separate conditions sometimes to know exactly what an else means. if you are unlucky, your two digitalRead() won't be the same thing if you catch a bounce for example.
Code could look like this
#include "Mouse.h"
const byte buttonPin = 6;
bool commandSent = false;
void setup() {
pinMode(buttonPin, INPUT_PULLUP);
Mouse.begin();
}
void loop() {
if (digitalRead(buttonPin) == LOW) { // button pressed
if (!commandSent) { // is it a new press?
Mouse.move(0, 0, 1);
delay(20); // poor's man anti-boucing
commandSent = true;
}
} else { // button not pressed
commandSent = false;
}
}