I want to delete the consecutive duplicate lines. i.e. for example
**test.txt** car speed is good bike slower than car plane super fast super fast bullet train
Why don't you just use uniq?
uniq
uniq file.txt
Results:
car speed is good bike slower than car plane super fast bullet train super fast
You can also do this with awk:
awk
awk 'line != $0; { line = $0 }' file.txt