How to save a constant updating value

To everyone who assumes my code will not compile, you look really ignorant and rude right now as my code def compiles and will fully upload and run on my build.

PGTBOOS- I havent had a chance yet to implement your code into the program yet as i havent been next to the build. I will have a chance today. I thought i would try to better explain at least whenever i had the chance.

Here is full code with me trying to clean it up to an understandable read.

#include <serLCD.h>
#include <SoftwareSerial.h>
#include <LiquidCrystal.h>
#include <math.h>

int oldval=0; //sec value for the button
int state1=0;  //state the button is in
int val = 0; //first value for the button
const int button = 7; //pin for the push button (for testing)

// these constants won't change:
 const int xPin = 2;     // X output of the accelerometer
 const int yPin = 3;     // Y output of the accelerometer
//Button Left And Right pins (for use later)
int right = 4;
int left = 5;
// Set pin to the LCD's rxPin
 int pin = 1;
 serLCD lcd(pin);
 
 int Xraw, Yraw;
double xGForce, yGForce, Xangle, Yangle;
double saveY, saveX, state;
 
void setup() {
   // initialize serial communications:
   Serial.begin(9600);
   // initialize the pins connected to the accelerometer
   // as inputs:
   pinMode(xPin, INPUT);
   pinMode(yPin, INPUT);
   
   Serial.write(0xFE);   //command flag
   Serial.write(0x01);   //clear command.
   delay(10);

 Serial.print("Lets Begin");
 delay(1000);
}

void loop() {
//   lcd.clear();
   Serial.write(0xFE);   //command flag
   Serial.write(0x01);   //clear command.
   delay(10);
   // variables to read the pulse widths:
   int pulseX, pulseY;
   // variables to contain the resulting accelerations
   int accelerationX, accelerationY;
   
   // read pulse from x- and y-axes:
   pulseX = pulseIn(xPin,HIGH);  
   pulseY = pulseIn(yPin,HIGH);
   
   Xraw = pulseIn (xPin, HIGH);
   Xraw = pulseIn (xPin, HIGH);
   Yraw = pulseIn (yPin, HIGH);
   Yraw = pulseIn (yPin, HIGH);

   // Calculate G-force in Milli-g's.

   xGForce = (( Xraw / 10 ) - 500) * 8;
   yGForce = (( Yraw / 10 ) - 500) * 8;

   // Calculate angle (radians) for both -x and -y axis.

   Xangle = asin ( xGForce / 1000.0 );
   Yangle = asin ( yGForce / 1000.0 );

   // Convert radians to degrees.

   Xangle = Xangle * (360 / (2*M_PI));
   Yangle = Yangle * (360 / (2*M_PI));

//save angle when button is pushed, then compare to live reading send a zero once live reading
//is below saved angle
  
  Serial.print("Y Angle: ");
  Serial.print(Yangle);
val= digitalRead(button); //Read input
if ((val==HIGH) && (oldval==LOW)){
    Serial.write(0xFE);   //command flag
    Serial.write(192);    //position
    saveY=Yangle;
    Serial.print(saveY);
    delay(150);
  } else if (Yangle <= -10) {
    Serial.write(0xFE);   //command flag
    Serial.write(192);    //position
    Serial.print("<= -10");
    delay(150);
  } else {
    Serial.write(0xFE);   //command flag
    Serial.write(192);    //position
    Serial.print("Please tilt");
    delay(150);
}
}