Very bad code that, see the comments for this first fragment:-
void loop() // run over and over again
{
int sensorValue = analogRead(A0); // this value is never used so why take it?
do
{
int sensorValue = analogRead(A0); // this creates a new and different instance of the variable each time it is run.
// this means that you are filling your stack with useless variables which will eventually crash the system
delay(100); // why? it is doing nothing for anything