I do not have time to write your code.
But here is some old code you can look at to see how Pic Basic code is written.
It basically is a test code for a POT.
And read the threads I linked you to earlier.
Code:
'#####################
'16F877A

DEFINE OSC 20

'####################
'LCD SET UP
DEFINE LCD_DREG     PORTB
define LCD_DBIT     4
DEFINE LCD_RSREG    PORTB
DEFINE LCD_RSBIT    1
DEFINE LCD_EREG     PORTB
DEFINE LCD_EBIT     0
DEFINE LCD_BITS     4
DEFINE LCD_LINES    2
DEFINE LCD_COMMANDUS    2000
DEFINE LCD_DATAUS   50

'#####################
V1		VAR	BYTE
LED	VAR	PORTD.2

PAUSE 1000

RUN:
LCDOUT $FE,1,"POT"
LCDOUT $FE,$C0,DEC V1
PAUSE 100
POT PORTC.7,127,V1
IF V1 < 100 THEN
GOTO LMP1
ELSE 
GOTO LMP2
ENDIF
GOTO RUN

LMP1:
HIGH LED
GOTO RUN

LMP2:
LOW LED
GOTO RUN

END