The last failure link in KMP automaton
The link for position $i$ is not determined by the letter at position $i$  but instead by the letter $b$ at position $i-1$ (and the failure link at $i-1$). 

For the rest you correctly describe the algorithm: follow the failure links until we find a position $j$ such that the letter at that position equals $b$.

Usually the failure link at the last letter is not computed. The reason is that one does not need it: when we have reached the last position we have found the pattern! However, if we want to find the next match, a failure link at the end would be helpful.