current-user_can not working in loop

From Codex :

Do not pass a role name to current_user_can(), as this is not
guaranteed to work correctly (see #22624) Instead, you may wish to try the check user role function put together by AppThemes.

I would propose to use is_user_logged_in() to check your function.