Do I need to hold hmc5883l straight?

To get useful direction readings, you must hold the magnetometer level, with the Z axis vertical. The magnetometer must also be calibrated, or it won't work at all. Adafruit has a calibration tutorial.