Your answer is incorrect. Two functions are distinguished by which element is mapped to which element.
There are $\binom{6}{3}$ ways to exclude three of the six elements in set $A$ from the image.
That leaves three possible images for each of the six elements in the domain. Hence, there are $3^6$ functions from set $A$ to the three elements in set $A$ we have not excluded. However, some of these functions do not have three elements in their image. We must subtract those functions which miss one or more of the three elements we have not excluded from the image.
There are $\binom{3}{k}$ ways to exclude $k$ of the three remaining elements and $(3 - k)^6$ functions from set $A$ to the remaining elements. Hence, by the Inclusion-Exclusion Principle, the number of functions $f: A \to A$ such that $f$ contains exactly three elements in its image is
$$\binom{6}{3}\left[3^6 - \binom{3}{1}2^6 + \binom{3}{2}1^6\right]$$
Notice that if you want to count directly, you have to choose an image for each of the six elements in such a way that exactly three elements are in the range. You would have to choose which three elements were in the range and then consider three cases:
- Four elements are mapped to the same element of set $A$, with two other elements each being the image of one of the other two elements in set $A$
- Three elements are mapped to one element of set $A$, two elements are mapped to another element, and one element is mapped to a third element of set $A$
- Three elements of set $A$ are each the images of two elements of set $A$
That gives a count of
$$\binom{6}{3}\left[\binom{3}{1}\binom{6}{4}2! + \binom{3}{1}\binom{6}{3}\binom{2}{1}\binom{3}{2} + \binom{6}{2}\binom{4}{2}\binom{2}{2}\right]$$