See this which is the basis for the change you want to make: https://lee-mac.com/ssget.html
Try this untested change, however since you are editing each block in turn in the block editor it could be slow
EDITED CODE: Missed a ')'
(defun c:fb (/ block bname acount)
(setq block (ssget '((0 . "INSERT")))) ;; select single entity, for multiple selection its too slow anyway ;; CHANGED THIS LINE
(setq currentlayer (getvar "clayer"))
(setq acount 0) ;;ADDED THIS LINE
(while (< acount (sslength block)) ;; ADDED THIS LINE
(setq bname (cdr (assoc 2 (entget(ssname block acount))))) ;; index forgotten , 0 is the first;; CHANGED THIS LINE
(command "-bedit" bname )
(command "change" "all" "" "p" "la" currentlayer "")
; (command "setbylayer" "all" "" "yes" "yes")
(command "_.bclose" "_save") ;; close the editor
(setq acount (+ acount 1)) ;; ADDED THIS LINE
) ; end while ;; ADDED THIS LINE
(princ)
)
(vl-load-com)
(prompt "\nType FB to set all entities in a block to the current layer.")