Yes, it should be connected to the battery. You can see the location on your picture, on the left of the Varta sticker.
Edit: sorry too slow
As mentioned, the pipe should go between the battery and the outside so that the gasses given of from the battery are directed away from the interior of the car.
View attachment 45448
from your picture it looks like the place on the batter it should go is here:
View attachment 45451
regards
Andrew