How To Use KM Variables in Shell Script to Get List of Files in All SubFolders?

Double quotes with back-slashed quotes (like @Tom showed) are the way to go for this.

Quoting is always an issue, and the more layers, the more problems as each layer unravels one level of quoting.

In this case you have BBEdit’s shell worksheet and/or Keyboard Maestro’s action, followed by the bash sell, followed by the mdfind application itself doing quoting.

It is never going to be particularly easy to make that work.