You can substitute the value of $i in to see the exact command you're trying to run:
app4/ | sed -e "s/^.*(.)$/\1/"
This doesn't work because app4/ isn't a command. You're trying to pipe app4/ into sed, so you need to use something that outputs app4/:
echo app4/ | sed -e "s/^.*(.)$/\1/"
This works, but you don't really need to use sed for this; bash has quite a few string manipulation tools. For example, ${i#} will give you the length of $i, and ${i:j} will give you a substring starting at j, so ${i:$((${i#}-1))} will give you the last character.
The easiest way to do what you're trying is probably with ${i%/}. This will return $i, but will strip off a / from the end if there is one:
$ i="app4"; echo ${i%/}
app4
$ i="app4/"; echo ${i%/}
app4
Thus:
if [ "${i%/}" = "$i" ]
then
echo "file"
else
echo "folder"
fi
However, if all you really want is to know if $i is a valid directory, you can just use:
if [ -d "$i" ]