script to parse the properties file

Hi Friends,
I have a requirement to parse a properties file having a key=value pairs.
i need to count the number of key value pairs in the properties file and iterate through each key-value pair. I have written the script to read the number of lines from the property file, but cannot iterate through the count since the total number of lines is in string. Can you please help me in completing the below script.

  Kindly find the script below
#declaring the propertie file
 . appl.properties
#expression to count the number of lines excluding the blank lines
lines= cat appl.properties | sed '/^\s*$/d' | wc -l
echo "Number of lines is $lines"
for ((i=0;i -le 4; i++ ));
do
 echo "pradeep";


done

sample properties file

#key=value
firstname=Pradeep
lastname=kumar
country=India
language=English

Desired output from shell script:

It should read the number of line which is 4. And then iterate 4 times using for loop and then printing the name and the value for each key value.

-- please use code tags

I do not understand parse. Normally that means to break the file into components.
Not just count lines.

Are there comment lines? Please post a sample properties file

It looks like you are using bash. bash4 has associative arrays, bash3 does not. the bash3 method would save order. here example:

declare -A array
declare -a keys=()
declare -a vals=()
while IFS='=' read -r key val; do
        [[ $key = '#'* ]] && continue
        array["$key"]="$val"            #bash4
        keys+=("$key"); vals+=("$val")  #bash3
done < "input"

echo "Number of entries: ${#keys[@]} or ${#array[@]}"

# two separate array [bash3]
for ((i = 0; i < ${#keys[@]}; i++)); do
        printf '[%s]=[%s]\n' "${keys}" "${vals}"
done

# associative array [bash4]
for key in "${!array[@]}"; do
        printf '[%s]=[%s]\n' "$key" "${array[$key]}"
done