The book "An Introduction to Number Theory" by Tom A. Apostol states in its Theorem 4.2, the Abel's identity:
For any arithmetical function $ a(n) $ let $ A(x) = \sum_{n \le x} a(n) $, where $ A(x) = 0 $ if $ x < 1 $. Assume $ f $ has a continuous derivative on the internal $[y, x]$, where $0 < y < x$. Then we have $$ \sum_{y < n \le x} a(n) f(n) = A(x) f(x) - A(y) f(y) - \int_y^x A(t) f'(t)\,dt. $$
But then in Theorem 4.12, it applies Abel's identity in the following step like this:
Let $$ A(x) = \sum_{p \le x} \frac{\log p}{p} $$ and let $$ a(n) = \begin{cases} 1 & \text{ if } n \text{ is prime},\\ 0 & \text{ otherwise.}\end{cases}$$ Then $$ \sum_{p \le x} \frac{1}{p} = \sum_{n \le x} \frac{a(n)}{n} \; \text{ and } \; A(x) = \sum_{n \le x} \frac{a(n)}{n} \log n. $$ Therefore if we take $ f(t) = 1/\log t$ in Theorem 4.2 we find, since $ A(t) = 0 $ for $ t < 2 $,
$$ \sum_{p \le x} \frac{1}{p} = \frac{A(x)}{\log x} + \int_2^x \frac{A(t)}{t \log^2 t}\, dt $$
The whole theorem 4.12 is not important for my question. Only the above step is important for my question. How did the LHS become $ \sum_{p \le x} \frac{1}{p} $?
When I try to apply Abel's identity to $ a(n) $ defined above and $ f(t) = 1/\log t $, I get this as the LHS:
$$ LHS = \sum_{y < n \le x} a(n) f(n) = \sum_{0 < n \le x} \frac{a(n)}{\log n} = \sum_{p \le x} \frac{1}{\log p} \ne \sum_{p \le x} \frac{1}{p}. $$
The RHS matches fine when I apply Abel's identity:
\begin{align*} RHS & = A(x) f(x) - A(y) f(y) - \int_y^x A(t) f'(t)\,dt \\ & = \frac{A(x)}{\log x} - 0 - \int_0^x A(t) \frac{-1}{\log^2 t} \left( \frac{1}{t} \right)\,dt \\ & = \frac{A(x)}{\log x} + \int_2^x \frac{A(t)}{t \log^2 t}\,dt. \end{align*}
What mistake did I make that my LHS does not match the book's LHS?
I was finally able to straighten it out. While the book says, "take $ f(t) = 1/\log t$" while applying Abel's identity, it says nothing about what $ a(n) $ should be and that was the missing clue.
Due to the missing clue, I erroneously assumed $$ a(n) = \begin{cases} 1 & \text{ if } n \text{ is prime},\\ 0 & \text{ otherwise.}\end{cases} $$ but with this definition we are never going to get $ A(x) = \sum_{n \le x} a(n) = \sum_{n \le x} \frac{a(n)}{n} \log n $.
Here is what I did to straighten this out.
In Abel's identity replace $ a(n) $ with $ \frac{a(n) \log n}{n} $. Then take $ f(t) = 1/\log t $ like the books suggest. With these two things, everything begins to match.
Now indeed $ A(x) = \sum_{n \le x} \frac{a(n) \log n}n$.
LHS of Abel's identity now becomes:
$$ LHS = \sum_{n \le x} \frac{a(n) \log n}{n} \cdot \frac{1}{\log n} = \sum_{n \le x} \frac{a(n)}{n} = \sum_{p \le x}\frac{1}{p}. $$