sed can rewrite matching text as it passes through a stream. Replacement text can come from a variable.

Program

Play the script to replace a status word with a selected output value.

sed_replace.sh
#!/usr/bin/env bash

line="task:todo"
replacement=
updated="$(printf '%s\n' "$line" | sed "s/todo/$replacement/")"
echo "$updated"
#!/usr/bin/env bash

line="task:todo"
replacement=
updated="$(printf '%s\n' "$line" | sed "s/todo/$replacement/")"
echo "$updated"
#!/usr/bin/env bash

line="task:todo"
replacement=
updated="$(printf '%s\n' "$line" | sed "s/todo/$replacement/")"
echo "$updated"
sed substitute `s/old/new/` replaces the first matching text on each input line.
double quotes Double quotes around the sed script allow `$replacement` to expand.
stream rewrite The original variable stays the same; the rewritten text is captured separately.