Save Enemy Health when you win

Hey guys I am trying to figure out how to set my game up so when you win it adds +3 to the enemy health and it saves so it remembers their is a if statement at the end that figures out if the enemy is dead.

-- include Corona's "physics" library local physics = require "physics" -------------------------------------------- function scene:create( event ) physics.start() -- Called when the scene's view does not exist. local filePath = system.pathForFile("enemyhealth.txt",system.DocumentsDirectory) local fh, errStr = io.open(filePath,"a") -- INSERT code here to initialize the scene -- e.g. add display objects to 'sceneGroup', add touch listeners, etc. local movement = 9 local playerhlth = 10 local enemyhlth = 13 local nmberenemys = 1 local sceneGroup = self.view -- create a grey rectangle as the backdrop local sidebar = display.newRect(-50,0,50,600) physics.addBody(sidebar,"static") local bg = display.newRect(250,100,1000,1000) bg:setFillColor(0,0,1) local square = display.newRect(50,150,30,30) square:setFillColor(1,0,0) physics.addBody(square,"dynamic") local sidebar2 = display.newRect(500,0,50,600) physics.addBody(sidebar2,"static") local enemy = display.newRect(400,50,30,30) physics.addBody(enemy,"dynamic") local jumpbtn = display.newImage("arrowup.png",20,290) jumpbtn:scale(0.1,0.1) local spike = display.newImage("spike.png",-10,230) physics.addBody(spike,"static") local spike2 = display.newImage("spike.png",475,230) physics.addBody(spike2,"static") spike2:rotate(60) enemy.category = "enemy" -- Make character jump function squarejump(event) if(event.phase == "began") then square:setLinearVelocity( 0, -200 ) end end jumpbtn:addEventListener("touch",squarejump) local function attackenemy( event ) enemyhlth = enemyhlth- 1 print("main player is attacking") local enemyhealth = display.newText(enemyhlth,enemy.x,enemy.y,25,25) transition.to(enemyhealth,{time = 4000,x=0,y=-500}) print("enemy health is",enemyhlth) if enemyhlth == 0 then square:removeSelf() local enemy print("enemy is dead :)") composer.removeScene("level1") composer.gotoScene("youwin") enemyhlth = enemyhlth+3 end end 

.

try using a global container?

try using a global container?