You are mixing constructs from Awk and bash together. Assuming you want an if-else clause in Awk you need to do,
awk -F'#' '$3 == "A" && $4 == "B"{c+=$2;} END{printf "count=%d\n",c}' file.csv
count=41
for a sample input I produced as
$ cat file.csv
junk#21#A#B
junk#22#C#D
junk#20#A#B
junk#19#D#E
i.e. the statment '$3 == "A" && $4 == "B" implicitly means do the action of sum calculation only if $3 equals A and $4 equals B
Explicit usage of if can be done as something below,
awk -F'#' '{if ($3 == "A" && $4 == "B") {c+=$2;}} END{printf "count=%d\n",c}' file
count=41
It is NOT recommended to use a pure bash script for parsing/looping over files, but for mere practice if you want a way, you can do something like
#!/bin/bash
unset count
# The '_' in read implies ignore rest of the line
while IFS='#' read -r col1 col2 col3 col4 _
do
[[ "$col3" == "A" && "$col4" == "B" ]] && ((count+=col2))
# Here the '[[' implies the if-clause and '&&' implies do on true condition
done<file
printf "%d\n" "$count"
Awkandshelltogether.