Analog Read problem

You need to have the grounds of the Arduino and the LM317 -ve output connected.

But that isn't measuring the battery input voltage to the regulator. The point of a regulator is that the output will stay constant until the input gets too low for the regulator to maintain it.

To measure a 12V battery voltage you just need a simple 2-resistor voltage divider.

Steve