Find all functions $f$ from positive integers to themselves, such that the followings hold.
$1)$.for each positive integer $n$ we have $f(n)<f(n+1)<f(n)+2020$.
$2)$.for each positive integer $n$ we have $S(f(n))=f(S(n))$ where $S(n)$ is the sum of digits of $n$ in base $10$ representation.
We need to find all functions \( f \) from positive integers to themselves such that the following conditions hold:
1. For each positive integer \( n \), we have \( f(n) < f(n+1) < f(n) + 2020 \).
2. For each positive integer \( n \), we have \( S(f(n)) = f(S(n)) \), where \( S(n) \) is the sum of digits of \( n \) in base 10 representation.

We claim that \( f(x) = x \) is the only function that satisfies the given functional equation.

1. **Verification that \( f(x) = x \) satisfies the conditions:**
   - For condition 1: \( f(n) = n \) and \( f(n+1) = n+1 \). Clearly, \( n < n+1 < n + 2020 \).
   - For condition 2: \( S(f(n)) = S(n) \) and \( f(S(n)) = S(n) \). Thus, \( S(f(n)) = f(S(n)) \).

2. **Proof that no other solutions exist:**

   **Claim 1: \( f(1) = 1 \)**
   - Consider \( S(f(9)) = f(S(9)) \). Since \( S(9) = 9 \), we have \( S(f(9)) = f(9) \).
   - This implies \( f(9) \) is a single-digit number.
   - Given that \( f \) is strictly increasing and maps positive integers to positive integers, \( f(n) \geq n \). Therefore, \( f(9) \geq 9 \).
   - Combining these, we get \( f(9) = 9 \).
   - Since \( f \) is strictly increasing, we must have \( f(1) = 1, f(2) = 2, \ldots, f(8) = 8 \).

   **Claim 2: \( f(10^n) \) is a power of 10 for all \( n \in \mathbb{N} \)**
   - Consider \( S(f(10^n)) = f(S(10^n)) \). Since \( S(10^n) = 1 \), we have \( S(f(10^n)) = f(1) = 1 \).
   - This implies \( f(10^n) \) must be a power of 10.

   **Claim 3: For sufficiently large \( n \), \( f(10^n) = 10^n \)**
   - Let \( f(10^n) = 10^k \) for some sufficiently large \( n \). Since \( f \) is strictly increasing, \( k \geq n \).
   - Consider \( m = 2 \cdot 10^{\frac{10^n - 1}{9}} - 1 \). Then \( S(m) = 10^n \).
   - Thus, \( S(f(m)) = f(S(m)) = f(10^n) = 10^k \).
   - The minimum number with a sum of digits \( 10^k \) is \( 199\ldots9 \) (where 9 occurs \( \frac{10^k - 1}{9} \) times), i.e., \( 2 \cdot 10^{\frac{10^k - 1}{9}} - 1 \).
   - Therefore, \( f(m) \geq 2 \cdot 10^{\frac{10^k - 1}{9}} - 1 \).
   - If \( k > n \), then \( k \geq n + 1 \). Note that \( f(t+1) < f(t) + 2020 \) and \( f(1) = 1 \) implies \( f(t) < 2020t \).
   - Thus, \( 2020m > f(m) \geq 2 \cdot 10^{\frac{10^{n+1} - 1}{9}} - 1 \geq 10^{\frac{10^{n+1} - 10^n}{9}} m \).
   - This is clearly false for sufficiently large \( n \). Hence, our assumption that \( k > n \) was wrong. Therefore, \( k = n \).

   - This proves that \( f(10^n) = 10^n \) for sufficiently large \( n \).

3. **Conclusion:**
   - Since \( f(n) = n \) for infinitely many \( n \in \mathbb{N} \) and \( f \) is strictly increasing, we conclude that \( f(n) = n \) for all \( n \in \mathbb{N} \).

\(\blacksquare\)

The final answer is \( \boxed{ f(x) = x } \).