You have to specify how to determine which "aa" sequence to replace. Assuming you want to replace any "aa" sequence that is neither at the beginning, not at the end, of the string, you may want to use a look-behind and a look-ahead assertion. This is an example under the Perl debugger:
DB<1> $aa = "aabbccddaaffddnnaa";
DB<2> $aa =~ s/(?<=.)aa(?=.)/ee/;
DB<3> print $aa
aabbccddeeffddnnaa
HTH.