Question: Error: unterminated procedure despite having end proc

Here is my code (will attach a screenshot below with the errors, since the formatting gets wonky if I try to paste it as text)

What might be the problem here? I seem to have proc and end proc, but Maple seems to be dividing my code into two sections, and evaluating them separately

https://imgur.com/a/npbF9NG

Please Wait...