Look at what the "IP address printer" is doing. Strip out the stuff involved in printing the address from the stuff involved in getting the address to print. What is left in the get address to print part?
Ethernet.localIP()
You should be able to figure out where to make that call, and assign the results (byte by byte) to another variable.
Before you get too excited, though, think about WHERE the localIP() method gets the data that was being printed.
Ethernet.begin(mac, ip);
You TOLD it what its address is.
The only way your Arduino's address is going to change is if you don't have the router configured properly to always assign the same address to the Arduino or if you are using DHCP.
If you are using DHCP, you'd know about the address assigned to the Arduino, and there would be a lot of code dealing with getting an IP address.
Since there isn't, it's safe to assume that the problem is with your router, not with the Arduino.