replaceAt() function

use: replace character at given index with ch for valid index.