I copied your code and ran it without a problem (after I removed the + and > symbols inserted by the console, of course).
names <- data.frame(A = LETTERS[1:6], B = c("Stan", "Mary", "Mari", "Alex", "Alexa", "Bob"))
j <- 1L
nr <- nrow(names)
for(i in 1:(nr-1))
{
eq <- adist(names[i,2],names[i+1,2], counts=TRUE)
dim(eq)
if(eq<3L & eq>0L)
{
cat(sprintf(" %3d %20s %20s/n",j,names[i,2], names[i+1,2]))
j <- j+1
}
}
#> 1 Mary Mari/n 2 Alex Alexa/n
Created on 2020-04-24 by the reprex package (v0.3.0)